Controlling where you post Excel data
(Originally posted by Laura on 6/13/2006)
When i send my data to excel, it doesn't start at the top of the sheet, but instead writes it further down apparently where it last left off. So i'm stuck with a large amount of blank cells heading my data.
0
Comments
(Originally posted by Dean on 6/13/2006)
You have control of where to place the data into an Excel spreadsheet through the Export Options. If you want it to start at cell A1 each time, choose -
Position data set at:
Row: 1 Col: 1
Increment position for next data set by:
Row: 0 Col: 0
(Originally posted by CTMurray on 6/21/2006)
I would like to hop in as well. I need to use a macro to open a specific Excel spreadsheet. It is working now but opens a new workbook or will add data to my desired workbook if it is already open. Can't figure out how to get it to open a specific file. Here is what I have tried, including making the file name even more detailed - but to no avail.
ret = IpDde(DDE_SET, "append", "2")
ret = IpDde(DDE_SET, "row", "2")
ret = IpDde(DDE_SET, "col", "1")
ret = IpDde(DDE_SET, "topic", "[Cumberland template.xls]Sheet1")
ret = IpDde(DDE_SET, "target", "C:\Srccode\o2kpsr1\Disk1\PFiles\MSOffice\Office\EXCEL.EXE")
ret = IpBlbSaveData("", S_HEADER+S_Y_AXIS+S_STATS+S_DDE)
Any thoughts
(Originally posted by Chris Tully on 6/21/2006)
Please take a look at Solution #703 on the Solutions Zone. This is a macro that demonstrates controlling Excel from an Image-Pro macro via COM, rather than DDE. In particular, it deomstrates putting the data in specific cells, charting data, and working with two workbooks at the same time. This method is slightly more complicated, since you have to extract the data you want to send to Excel from Image-Pro into arrays in your macro, and then send it over to Excel. However, in return for the added complexity, you gain incredible amounts of flexibility and power - you can start with a completely blank spreadsheet, and populate it with the necessary data AND formulae.
In the new version of Image-Pro the position can be defined in the command, AbsolutePosition property, like this:
Please check this forum post https://forums.mediacy.com/discussion/comment/2470#Comment_2470
Yuri
Thanks for this - a great start. I was hoping to exercise a little more control (automation) from my script.
1) A shell to Open a specified Workbook based on a path and filename
2) Test that the Workbook is Open
3) Create/Select a specified Worksheet as necessary
4) Output datatable data to specified locations (defined as variables dependent upon object class)
5) Output corresponding Features Manager and some configuration data to specified cell addresses on the corresponding worksheet
You get the picture.
Best,
Chris
The ExportToExcel command has other usefull properties, here is the link to the help page: https://help.mediacy.com/Image-Pro/Automation/11/html/T_MediaCy_Commands_Export_ExportToExcel.htm
Also, the macro language can execute any VBA Excel commands, if you use Excel.Application object, as in the example below (project attached)
You can find more details about this class on Microsoft website https://learn.microsoft.com/en-us/dotnet/api/microsoft.office.interop.excel.application?view=excel-pia
Yuri
Best,
Chris