LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to run VBA macros stored in the Personal.xls file or in .bas files from a LabView vi?

I am running LabView6.1 and am trying to work with macros in Excel and Word. I am using the generic ActiveX controls (i.e. not the Microsoft toolkit) and would like to be able to run macros to exchange data between Word and Excel without user-input. Strange thing is that when I open up an instance of Excel from a LabView vi, I can't see the macros stored in the Personal.xls file, which should be available to every workbook whenever Excel is opened. I also don't see a way to import macros into a spreadsheet from an external .bas file without the user doing it manually in Excel. The goal is to not tie a vi to a specific spreadsheet or Word document, but to keep it as ge
neral as possible. Any hints?
0 Kudos
Message 1 of 4
(3,158 Views)
Robert M.,

Yes this is possible because our Office toolkit does this. Importing a .bas file can be done by using an Excel._Workbook to a VBProject to a VBComponents object and calling the Import method.
As for why you cannot see items in Personal.xls, I am not sure. All you are doing is using ActiveX, so if Microsofts' ActiveX control does not let you see the file, I would ask them to see if they have any examples on how to do this. I tried searching the Help in Excel 2000 for personal.xls and I came up with nothing. I did not know that you could have globally available workbooks. Could you point me to more information on that, or am I on the wrong track here?

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 2 of 4
(3,158 Views)
Sorry, I should have said I am using Office 97. Personal.xls is a way to store macros that you want to be available to all workbooks. Perhaps they have changed things for Office 2000, though.
0 Kudos
Message 3 of 4
(3,159 Views)
I am having the same problem.  I have used personal.xls macros from other programs, but I am not sure how to tell labview how to find personal.xls, since you can't actually point to the file (I think it's hidden in a dll or something).  I can't say I have a solution, just that you are not the only one.
0 Kudos
Message 4 of 4
(3,070 Views)