From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Copy Excel Spreadsheet to Workbook embedded in LV

I've seen in this thread http://forums.ni.com/ni/board/message?board.id=170&message.id=216180&query.id=84359#M216180 that you can embedd an Excel spreadsheet into LabVIEW (though its the Office Web Components (OWC) Spreadsheet container, so lacks some functionallity). I was wondering if anyone has had success importing an exisiting worksheet into this object. I know I can grab a Range and put it into the object, but I'd like to import the colors, formatting, etc. I can manaully copy and paste, so I know the OWC object can handle formatting. I tried using the Copy Invoke Node, as specified in http://forums.ni.com/ni/board/message?board.id=170&message.id=68127&query.id=84536#M68127, but I get an error -2146827284. This does work though when using another Excel workbook instead of the OWC workbook.
Does anyone know how to import an exisiting workbook into the OWC container?
 
Michael
0 Kudos
Message 1 of 3
(2,596 Views)
Hi Michael,
 
You might want to check this post. Can you tell us what version of LabVIEW and Excel you have?
Regards,

Hillary E
National Instruments
0 Kudos
Message 2 of 3
(2,565 Views)

LV8.5, Excel 2003.
Thank you for the post, however it didn't really relate much; the error is different. I did try making the VI run in the User Interface thread; same error comes about.

I did find a workaround. First, my last VI incorrectly tried to change the OWC Worksheet to an Excel._Worksheet; apparently they are different. Instead of using the Copy method for a Worksheet, I grabbed the UsedRange property and used the Copy method for a Range. The formatting is retained; the column width and row height are not so I had to set those manually.

If anyone has a better solution, I would love to see it.

Michael



Message Edited by miguelc on 02-29-2008 10:16 AM
0 Kudos
Message 3 of 3
(2,552 Views)