Refresh worksheet on open
Hi all,
What is the code to refresh a worksheet which is linked to a database.
I have searched the internet but I can't find it.
code is written in Cognosscripteditor.
sub main()
dim prompt as long
prompt = 200503
Dim objExcelApp As Object
Set objExcelApp = CreateObject("Excel.Application")
objExcelApp.Workbooks.Open "M:\OPS_Processes\Reports\Status Codes\status update.xls"
'objExcelApp.ActiveWorkbook.sheets("BU").RefreshAl l *** this is not working
' ***** when file status update.xls is openend, then all worksheets needs to be refreshed.
objExcelApp.Visible = true
' ******** removed the database link from the copied file
objExcelApp.ActiveWorkbook.sheets("BU").querytable s(1).delete
objExcelApp.ActiveWorkbook.sheets("Country").query tables(1).delete
objExcelApp.ActiveWorkbook.sheets("Depot").queryta bles(1).delete
objExcelApp.ActiveWorkbook.sheets("Con Details").querytables(1).delete
objExcelApp.ActiveWorkbook.SaveAs "M:\OPS_Processes\Reports\Status Codes\reports\status update " & prompt & " .xls"
|