Apr 5, 2005 #1 Dickx Technical User Joined Aug 24, 2001 Messages 33 Location US What would be the code behind a command button in Access to open Excel to a specific spreadsheet and worksheet. c:\order.xls Worksheet Summary
What would be the code behind a command button in Access to open Excel to a specific spreadsheet and worksheet. c:\order.xls Worksheet Summary
Apr 5, 2005 #2 tonyflavell Programmer Joined Jul 21, 2001 Messages 119 Location GB Try Dim MyXL as Excel.Application Dim MyWorkbook as Excel.Workbook Dim MySheet as Excel.WorkSheet Set MyXL = New Excel.Application Set MyWorkbook = Excel.Workbooks.Open("C:\Order.xls") Set MySheet = MyXL.Sheets("Sheet 1") You may have to play with this depending on the version of Excel and Access. Also look in "HELP" for the "GetObject" function. Tony Upvote 0 Downvote
Try Dim MyXL as Excel.Application Dim MyWorkbook as Excel.Workbook Dim MySheet as Excel.WorkSheet Set MyXL = New Excel.Application Set MyWorkbook = Excel.Workbooks.Open("C:\Order.xls") Set MySheet = MyXL.Sheets("Sheet 1") You may have to play with this depending on the version of Excel and Access. Also look in "HELP" for the "GetObject" function. Tony