I have written some code that exports calender information from outlook into an excel workbook. The workbook refresh's at set periods of time.
The problem I have is when the macro re-runs it opens another execl workbook, so I need some code that will determine whether or not it is already open.
Anyone got any ideas ? (Part of the code is below)
'Pick up the Excel document
strsheet = "C:\My Documents\Retail Tel.xls"
Set objExcelApp = Application.CreateObject("Excel.Application"
If "The workbook 'strSheet' is not open" Then
objExcelApp.workbooks.Open (strsheet)
end if
Set objExcelBook = objExcelApp.ActiveWorkbook
Set objExcelSheets = objExcelBook.Worksheets
Set objExcelSheet = objExcelBook.Sheets(1)
objExcelSheet.Activate
The problem I have is when the macro re-runs it opens another execl workbook, so I need some code that will determine whether or not it is already open.
Anyone got any ideas ? (Part of the code is below)
'Pick up the Excel document
strsheet = "C:\My Documents\Retail Tel.xls"
Set objExcelApp = Application.CreateObject("Excel.Application"
If "The workbook 'strSheet' is not open" Then
objExcelApp.workbooks.Open (strsheet)
end if
Set objExcelBook = objExcelApp.ActiveWorkbook
Set objExcelSheets = objExcelBook.Worksheets
Set objExcelSheet = objExcelBook.Sheets(1)
objExcelSheet.Activate