LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can someone explain me this?

Can someone explain me why LabVIEW embeds the graphic in sheet 1 if i specify location as "prueba"? The vi is for LV 5.0.1f1 and Excel 2000, it just creates a workbook, adds some data and creates a chart. I've tried to ask a NI engineer but i receive no answer.
Thanks,

Gorka
0 Kudos
Message 1 of 4
(2,910 Views)
Hi Gorka,

I am not sure if this helps but the help file for the add Sheets method says

"Add Method (Sheets Collection)


Creates a new worksheet, chart, or macro sheet.

Syntax

expression.Add(Before, After, Count, Type)

expression Required. An expression that returns a Sheets object.

Before Optional Variant. An object that specifies the sheet before which the new sheet is added.

After Optional Variant. An object that specifies the sheet after which the new sheet is added.

Count Optional Variant. The number of sheets to be added. The default value is one.

Type Optional Variant. Specifies the sheet type. Can be one of the following XlSheetType constants: xlWorksheet, xlChart, xlExcel4MacroSheet, or xlExcel4IntlMacroS
heet. The default value is xlWorksheet.

Remarks

*****
If Before and After are both omitted, the new sheet is inserted before the active sheet.
*******" (I added asterisks for emphesis).

the help for the "location method" says,

"Add Method (Sheets Collection)


Creates a new worksheet, chart, or macro sheet.

Syntax

expression.Add(Before, After, Count, Type)

expression Required. An expression that returns a Sheets object.

Before Optional Variant. An object that specifies the sheet before which the new sheet is added.

After Optional Variant. An object that specifies the sheet after which the new sheet is added.

Count Optional Variant. The number of sheets to be added. The default value is one.

Type Optional Variant. Specifies the sheet type. Can be one of the following XlSheetType constants: xlWorksheet, xlChart, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet. The default value is xlWorksheet.

Remarks

If Before and After
are both omitted, the new sheet is inserted before the active sheet.
"

Just trying to help,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 4
(2,910 Views)
Ben, thanks for trying, the problem is that the graph is created in the first sheet, instead of being created in prueba sheet, as especified in the Name entry of the location method.
Thanks anyway
0 Kudos
Message 3 of 4
(2,910 Views)
Gorka,

I've been using the Report Generation Toolset for a while and tried to do the same thing that you're doing and was able to.

Looking at your code you may be calling the incorrect object. From a workbook you are getting a chart object, and that is why when you add in the graph it is adding it to the sheet that is the chart. I found a similar example on DevZone which does the same thing.

I'm assuming you're trying to get the chart inserted into a worksheet where the table shows up. I've used the toolset to do it and could only follow the code to the following point:
What you should do is from the workbook get a worksheet out, as you are doing in EscribirArrayNums.vi. Then from that you need to get a shape object and then call A
ddOleObject to add a graph as an object that is embedded into the worksheet. This is different from the approach in your code where the entire sheet object is actually a chart ... you can see this by going into excel and right clicking on the "Chart1" tab in the excel file created by your code and clicking on "View Code". You'll see that "Chart 1" is listed as an object of type Chart and not Worksheet.

Sorry I couldn't give you the final answer but hope this helps.
Regards,
Kamran
An
0 Kudos
Message 4 of 4
(2,909 Views)