>>Hi All
>>I have this code in excel automation
>
>> Release All Like oEx*
>> Local oExcel
>> gcxlsLive = "C:\TMP\SHR_FND.XLS"
>> oExcel = Createobject("Excel.Application")
>> oWorkbook = Getobject(gcxlsLive)
>> oExcel.workbooks.Open(gcxlsLive)
>> oExcel.DisplayAlerts = .F.
>> oExcel.Quit()
>> Release oExcel
>>
>>REST OF CODE...
>
>
>>
>>The SHR_FND.XLS file imports external data from a web query.
>>When I excecute the code it does not update my tables with the latest data, however, If i open the excel file manualy through excel it request confirmation for automatic refresh and then I save and it works ok.
>>
>>What I would like is automatic refresh without user intervension.
>>
>>Any help is appreciated.
>
>It may depend on how the "file imports external data from a web query", and on the Excel version. If, say, there is an auto_open macro, then try something like:
>
>
>oExcel = Createobject("Excel.Application")
>oExcel.DisplayAlerts = .F.
>oExcel.visible = .t.
>oExcel.AutomationSecurity = 1
>oExcel.workbooks.Open(gcxlsLive)
>oExcel.Application.Run("Auto_Open")
>
>
>Thanks Yuri for your reponse
>when I included your changes I get the message ole dispach error cannot find the macro Auto_open.
>Then after several minutes I get the message enable automatic refresh and if yes still no update bacause it does not save.
>
>Thanks
Rasheed,
I can only repeat: How to do it may depend on how the "file imports external data from a web query", and on the Excel version.
If you do not have auto_open macro in your file, then you cannot use it.
Only YOU know how the "file imports external data from a web query", and what is the Excel version. It would be good if you provide me with this. Otherwise it is like I am walking in the dark.
Here is my final advice until you provide more information:
oExcel.workbooks.Open(gcxlsLive)
oExcel.Activesheet.Usedrange.QueryTable.Refresh()