Apr 5, 2005 #1 Dickx Technical User Aug 24, 2001 33 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 Jul 21, 2001 119 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