LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting access to ActiveX Enums

I posted an earlier question about being able to access the Excel VBA Help in LabVIEW to view the help for an Excel ActiveX Property or Methods node.  One of my PCs (running Win XP) could access the help, another (running Windows 7) could not.

 

This is a related question that could be part of the same problem.  More than a year ago, I wrote a VI that used the _Workbook SaveAs method to save an Excel file that I created with LabVIEW.  To get it to save the file in the proper format, I wired an Enum whose value was "xlWorkbookNormal" to the "FileFormat" slot in the Method.  [The enum in question takes on a range of values, from xlAddin,xlAddin8 to xlOpenDocumentSpreadsheet].  If I leave this unwired, I can still save the file, it "looks" OK when Excel opens it, but Excel complains that it is "not in an expected format", or something like that -- you can fix it by doing an explicit SaveAs and specifying the 97-2003 format.

 

My problem is I no longer remember how I got this enum.  I presume that on my XP machine, I right-clicked something and the enum popped up.  However, I'm now coding on my Windows 7 PC and can't figure out how to do this.  [I got my new program to work by finding my older VI and simply copying the enum constant into my new routine].

 

So my (visual) basic question is, when expanding an ActiveX property or method in LabVIEW that takes a variant which corresponds to an Office enum, how do you get the right enum (let alone figure out which of its various instances to use)?

0 Kudos
Message 1 of 4
(2,515 Views)

Hi Bob,

 

The only way I know to create the enum is to use the FileFormat property node. This property node returns the file format of an excel workbook and you can create an enum control from this output. I have attached a small example to illustrate this.

 

Thanks,

0 Kudos
Message 2 of 4
(2,497 Views)

That's a very clever solution that can certainly serve as a solution, particularly if you already have a file of the desired format to use to get the appropriate value for the enum.  I'm pretty sure, however, that I was originally able to get the enum directly, possibly through the ActiveX Help system ...  Unfortunately, I didn't document the trick at the time I did it ...

 

Bob Schor

0 Kudos
Message 3 of 4
(2,483 Views)

Hi Bob,

 

Even if you don't have a file with the appropriate file format, you can get that enum just by placing the ActiveX nodes on the block diagram. After playing around some more, I still wasn't able to get that enum except for the method I mentioned above.

 

Thanks,

0 Kudos
Message 4 of 4
(2,448 Views)