Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5355

ActiveX Excel - Add A New Worksheet To An Open Workbook

$
0
0

Looking for example code to add a new worksheet to an open workbook in Excel 2013. Using CVI 2015.

 

I programatically got the Excel app opened, a workbook file loaded with multiple sheets, I'm reading from those existing sheets and indexing them for access, etc., I just can't figure out how to add a new sheet and then name it so I can write data to it.

 

Sadly, none of the CVI examples have that particular functionality in the code that I can find.

 

The help info for the exel2000.fp for the Excel_NewWorksheet( ) function states:

 

NOTE: Due to an unusual behavior in Microsoft Excel the object handle obtained from this function actually refers to the workbook object that contains the worksheet. Passing this workbook object handle to worksheet functions will result in a "No such interface supported." error (-2147467262). You must index into the worksheets collection of the workbook object to obtain an object handle for the worksheet. Use this function to create a new _Worksheet object, and obtain a handle to the object.

 

As helpful as that is, I can't get it to work. Can someone please provide a solution?

 

TIAA!

 

 

 


Viewing all articles
Browse latest Browse all 5355

Trending Articles