LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automation Refnum creation for Excel

Solved!
Go to solution

Hi,

 

So I had been working on reading Excel documents with the Report Generation Toolkit, but realized the document I was attempting to read is password protected & requires an update link (pivot table).

 

While searching I found a very useful toolkit attachment by Joe_H (post #2) http://forums.ni.com/t5/BreakPoint/Excel-Board/m-p/379682 . I'm attempting to re-create his VI but there are some things I don't understand. (I've only started working with refnums & variants)

 

My Questions:

 

1. Referring to my attachment 'refnum.png', the black automation refum is copied from the example VI and the purple one is the one I tried making. They have the same ActiveX Class, but the purple one throws an Error 3005 exemption. I can't seem to find that black arrow refnum.

 

Googling that error, gives a solution but I can't figure out how to use it or if it applies to me. http://forums.ni.com/t5/LabVIEW/error-3005-occured-at-automation-open-using-ActiveX-richtext-box/td-...

 

2. Referring to 'excel.png' for the Invoke Node - Workbooks, how does a person know how to use the variant datatypes? For instance WriteResPassword I just tried using a string and it worked. I've noticed the help info gets slimmer when working with Property/Invoke nodes.

 

Thanks for your time.

Download All
0 Kudos
Message 1 of 4
(3,882 Views)

 

I don't copy refnums.

 

Microsoft's Excel Object Model documentation is helpful. http://msdn.microsoft.com/en-us/library/wss56bz7.aspx

 

 

 

0 Kudos
Message 2 of 4
(3,864 Views)
Solution
Accepted by topic author bwhinch

I'm not sure why the difference in colors between the refnums, but I doubt that's the problem. Looks like it's just a weird artifact of opening a VI from an older version of LabVIEW. If you convert that refnum control to a constant, and then back to a control, it will turn pink, but I'd guess it will still work. Can you show more of you code, showing how you're using that refnum?

 

As nyc mentioned, you'll have to refer to the Microsoft documentation to determine what type of data to wire to the variant inputs. There's no LabVIEW documentation because it's not a LabVIEW component.

Message 3 of 4
(3,837 Views)

I think you are right about the artifact, I started up a new VI and didn't get that error 3005 anymore. (new as in 2010 SP1) I also came to that concusion when I tried to convert the old refnum to a constant.

 

I'll also include another good example I found incase someone finds this post. Message #5 by Nick_S http://forums.ni.com/t5/LabVIEW/Excel-Page-Numbering-with-ActiveX/m-p/389703

0 Kudos
Message 4 of 4
(3,825 Views)