10-16-2013 08:54 AM
Hi
i have problems to save my changed Excel File.
Diadem open my Excesheet, bring the "22"in to the Sheet and i close the excel without saving.
I coulnd´t found my mistake and couldn´t found some information on this forum / google / ...
Maybe some one has a idea!
Thanks a lot 🙂
Option Explicit 'Erzwingt die explizite Deklaration aller Variablen in einem Script. Dim ExcelApp, ExcelSheet Const ExcelMaximized =&HFFFFEFD7 ' Start Excel via OLE. - A new Excel instance always starts. Set ExcelApp = CreateObject("Excel.Application") ExcelApp.Visible = True ' True = Show ExcelApp. False = Hide ExcelApp. ExcelApp.WindowState = ExcelMaximized ' Maximize Excel window. ExcelApp.Workbooks.Open("c:\temp\_Test.xlsx") ' Open prepared DIAdem table in Excel. Set ExcelSheet = ExcelApp.Sheets("NIO_Files") ExcelSheet.Cells(2,1).Value = 22 'DemoNumber '?????????????? ExcelSheet.Parent.Saved = True ExcelApp.Quit ' In VBS, Excel must be closed explicitly. Set ExcelSheet = Nothing Set ExcelApp = Nothing
10-17-2013 01:15 AM
New Day - new google - got ist 😛
ExcelApp.ActiveWorkbook.Save
but i couldn´t find a overview about all the commands you can send to excel.
what helped me was to record a makro an look what happen in excel 😉
10-17-2013 03:41 AM
Hi MaikThierer,
a list of all available commands is only supported by microsoft.
You have to be carefull between available commands "inside" Excel and the available commands published to ActiceX/OLE. There might be a difference.
Regards,
Philipp K.
AE | NI Germany
11-26-2015 09:28 AM
Hi,
Need help on a similar situation.
What I want is, after opening an excel through diadem, make changes in it and then save the opened excel as a text file.
I modified the script line as given below;
ExcelApp.ActiveWorkbook.SaveAs ("c:\temp\_Test.txt")
The script file runs successfully saving the text file and text file opens properly but the data inside is not correct.
Does anyone know method to solve this?
Regards,
Fazil.
11-26-2015 11:16 AM - edited 11-26-2015 11:19 AM
Got it.
Should modify as given below;
ExcelApp.ActiveWorkbook.SaveAs"c:\temp\_Test.txt",20
The number 20 is XlFileFormat Enumeration Value for text format (refer: https://msdn.microsoft.com/en-us/library/office/ff198017.aspx)
Regards,
Fazil