I generate data files which I want to import into Excel worksheets and display as 3-D surface plots.
I am using an EXCEL module generated using the INTEL module wizard.
Using the AUTODICE sample code as a guide. I can successfully use the WorkBooks_OpenText routine
to load data from a text file into a worksheet and I can select cells and create a 3-Dsurface chart from them on the same worksheet.
Every time I use WorkBooks_OpenText a new workbook is created. I appear to have no choice about this. so my data and their associated charts
are eventually spread over several workbooks.
What I want to do is to move/copy all the seperate worksheets in the seperate workbooks ointo sheets in a single workbook.
The following Visual Basic code does what I want (where oSheet2 is the worksheet in workbook oWB2 that I want to copy and oSheet is the sheet in a seperate work book oWB before which I want to insert oSheet2):
' copy worksheet between workbooks
The second line is a further test which just repeats the copy but this time inserts the copied worksheet after the third sheet in oWB.
So, basically I am asking if anyone can show me how I might be able to do this using the $Worksheet_Copy or Worksheets_Copy routines in the Excel module?
A typical call is
SUBROUTINE $Worksheet_Copy($OBJECT, Before, After, $STATUS)
where $OBJECT is the integer handle to the worksheet I want to copy (no problem there) and Before or After are Variants describing where to copy.
Basically I have no Iidea how to construct the required Before or After variant which will do the job successfully and direct the copy to the other workbook.
I have tried using the handle to the worksheet in the other workbook after which I want the copied worksheet to be placed using
vInt%VT = VT_I4
vInt%VU%LONG_VAL = worksheet
CALL Check_Status(status, " Unable to copy worksheetfile ")
but that results in OLE error status = 0x80020009.
Any advice? Thanks in advance.
P.S. The contents of the variant can be seen in the screen shot. I note that several components of the variant are set to the same integer worksheet value even though I set only one of them.