Hi,
I was wondering if you can help. I'am trying to Open a Excel sheet that is linked to a PI database, wait 10sec for the data to refresh and then save and close the file. I'am trying to save the file as a txt delimiter file so to take a snapshot of the updated data (and not the format links to PI). Below is my effort
MyDateFormat = Year(now) & Right("0" & Month(Now), 2) & Right("0" & Day(now), 2)
Set Excel = CreateObject("Excel.Application")
Excel.Application.DisplayAlerts = False
Excel.Application.Visible = True
Excel.Workbooks.Open("C:\Program Files\Solvent_Tanks.xls")
Excel.RegisterXLL "pipc32.xll"
Excel.AddIns("PI-DataLink").Installed = False
Excel.AddIns("PI-DataLink").Installed = True
wscript.sleep(10000) 'sleep 10 seconds
Excel.ActiveWorkbook.SaveAs "C:\Program Files\Solvent_Tank_Reports\Solvents_" & MyDateFormat & ".txt", xlText, False
Excel.Activeworkbook.Close
Excel.Quit
WScript.Quit
The problem that I'am having is the saving of the file?. Also, I'am open to other ideas how I can get the raw data from the file (the snapshot of the data). Any ideas what's wrong?
Thanks - Rpax
I was wondering if you can help. I'am trying to Open a Excel sheet that is linked to a PI database, wait 10sec for the data to refresh and then save and close the file. I'am trying to save the file as a txt delimiter file so to take a snapshot of the updated data (and not the format links to PI). Below is my effort
MyDateFormat = Year(now) & Right("0" & Month(Now), 2) & Right("0" & Day(now), 2)
Set Excel = CreateObject("Excel.Application")
Excel.Application.DisplayAlerts = False
Excel.Application.Visible = True
Excel.Workbooks.Open("C:\Program Files\Solvent_Tanks.xls")
Excel.RegisterXLL "pipc32.xll"
Excel.AddIns("PI-DataLink").Installed = False
Excel.AddIns("PI-DataLink").Installed = True
wscript.sleep(10000) 'sleep 10 seconds
Excel.ActiveWorkbook.SaveAs "C:\Program Files\Solvent_Tank_Reports\Solvents_" & MyDateFormat & ".txt", xlText, False
Excel.Activeworkbook.Close
Excel.Quit
WScript.Quit
The problem that I'am having is the saving of the file?. Also, I'am open to other ideas how I can get the raw data from the file (the snapshot of the data). Any ideas what's wrong?
Thanks - Rpax