Jan 23, 2003 #2 BradB MIS Jun 21, 2001 237 US Give this a try. I created a form with a command button called cmdImport. Private Sub cmdImport_Click() Dim objXL As Object On Error GoTo err_cmdImport_click On Error Resume Next Set objXL = CreateObject("Excel.Application" With objXL.Application .Visible = True 'Open the Workbook .Workbooks.Open "C:\YourExcelFile.xls" .Quit End With Set objXL = Nothing Hope this helps! Upvote 0 Downvote
Give this a try. I created a form with a command button called cmdImport. Private Sub cmdImport_Click() Dim objXL As Object On Error GoTo err_cmdImport_click On Error Resume Next Set objXL = CreateObject("Excel.Application" With objXL.Application .Visible = True 'Open the Workbook .Workbooks.Open "C:\YourExcelFile.xls" .Quit End With Set objXL = Nothing Hope this helps!
Jan 23, 2003 #3 BradB MIS Jun 21, 2001 237 US Oops, use this. I tried to cut and paste the code from my application, but left somethings you don't need. Try this: Private Sub cmdImport_Click() Dim objXL As Object On Error Resume Next Set objXL = CreateObject("Excel.Application" With objXL.Application .Visible = True 'Open the Workbook .Workbooks.Open "C:\YourExcelFile.xls" End With Set objXL = Nothing This should be better. Upvote 0 Downvote
Oops, use this. I tried to cut and paste the code from my application, but left somethings you don't need. Try this: Private Sub cmdImport_Click() Dim objXL As Object On Error Resume Next Set objXL = CreateObject("Excel.Application" With objXL.Application .Visible = True 'Open the Workbook .Workbooks.Open "C:\YourExcelFile.xls" End With Set objXL = Nothing This should be better.
Jan 23, 2003 #4 Falcon99 Programmer Dec 3, 2002 164 US If you don't plan on VBA interaction try this: i = Shell("excel.exe", 1) Upvote 0 Downvote