Hi,
I tried to read the excel cell using read cell activity and that cell contain formula ,the data is of the month number suppose for April is 04but while reading it read as 00 instead of 04.can anyone have any idea regarding this issue.
True, if the Chart is inside a sheet then it works fine. However, if you move that chart to its own sheet within the file then the problem occurs. Iām trying to avoid solutions that force users to use a file in a specific way.
Iām going to just have the user remove the Chart or keep it inside a sheet, until thereās an ideal fix that doesnāt require workarounds.
Thanks.
Hey @ClaytonM
Sorry for Delayed Response
Well it is due to chart object.
So There are you can use chart inside an excel either in an existing sheet by embedding them or by moving the chart object to new location or sheet. by Moving a chart to new sheet or location either you can assign your sheet name or default naming will be like chart1,chart2ā¦and so on.
Here with Excel Application scope -the Worksheets interface only gives you worksheets - not charts.
The error message which you guys are getting is due to cast is wrong..
_Workbook.Sheets Returns a Sheets instance. mentioned interface gives us all types of sheets, not just worksheets; like charts, macro sheets, etc
On the other side , the Worksheets interface only gives you worksheets - not charts.
Regardsā¦!!
Aksh
So what you are saying is⦠I need to use Invoke Code?
I was able to get this working using the following:
I couldnāt for some reason get the Imports to work but just added the AssemblyReference in the .xaml file
Then I needed to Cast the Sheets to pull in only the Names as an array.
Any further advice is appreciated.
Thanks.
@Ohrid @balupad14
Using invoke code you will be creating another instance of the same spreadsheet.
Another idea is to Invoke VBA inside excel application scope, but you need to create a vbs file to Invoke the code and save it in a location. Your call.
Function Sheets()
Dim sheet As Worksheet,chart As Chart,s as string
'Get Sheet Names
For Each sheet In Worksheets
s = s & sheet.Name & ","
Next
'Get Chart Names (Remove this if not needed)
For Each chart In Charts
s = s & chart.Name & ","
Next
If (Right(s, 1)) = "," Then
s = Left(s, Len(s) - 1)
End if
Sheets=s
End Function
Is the Invoke VBA part of the 2018 Studio? I donāt think Iāve used that yet.
And, how does it work to attach to the correct Workbook or did you leave off part of your script, cause normally you need to create an Excel object?
In any case, I placed the Invoke Code before the Excel Scope and turned Visible on, so the Excel Scope attaches to the instance of the file. And, stored all the sheets to an Array so I can dynamically choose the correct sheet name.
Thanks.
Invoke VBA is part of latest Excel Package and it has to be placed inside Excel application scope. The Vb script will get executed on that specific excel spreadsheet and you donāt have to create the Excel object within your script.