View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default opening diff. worksheets in opened workbook

Set xlBook = xlApp.Workbooks.Open(strWorkbookName)
Set xlSheet 1= xlBook.Worksheets(strWorksheetName1)
Set xlSheet 2= xlBook.Worksheets(strWorksheetName2)



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"AlexD" wrote in message
...
How could I open another spreadsheet in the same workbook
if the workbook has been already opened?
I'm doing it from MS Access.

If logWorkbookIsOpened = False Then
'it's working good
Set xlBook = xlApp.Workbooks.Open(strWorkbookName)
Set xlSheet = xlBook.Worksheets(strWorksheetName)
xlSheet.Activate

xlApp.Visible = True

Else
'here is a mistake #0
Set xlSheet = Workbooks(strWorkbookName).Worksheets
(strWorksheetName)
xlSheet.Activate
xlApp.Visible = True

End If

Thanks