How to open spreadsheet from workbook

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • daffelito
    New Member
    • Feb 2008
    • 1

    How to open spreadsheet from workbook

    Hi, i have this button within Access that opens a workbook in excel. I have this code.

    Dim stAppName As String stAppName = "Excel.exe c:\workbook.xls " Call Shell(stAppName , 1)
    What i want is to ad an command to open a specific spreadshhet within that workbook, how do i do that?
  • trevor glover
    New Member
    • Feb 2008
    • 6

    #2
    Hi what you need to do in your dim statement is specify the sheet name as follows:
    Code:
    dim wkbk as excel.application
    set wkbk = createobject("excel.application")
    with wkbk
    .visible=true
    .workbook.open ("The path and name of the workbook")
    .sheets("The name of the sheet to activate").select
    
    end with
    Enjoy

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32634

      #3
      Check out Application Automation.

      Comment

      Working...