Hi everyone,
I have a procedure in my database that exports some information from Access 2007 into an Excel spreadsheet. The procedure works perfectly whenever I run it on my computer, but when one of my co-workers tries to run the same procedure on his computer, he gets a "Method 'Open' of object 'Workbooks' failed" error. It opens the spreadsheet, but then stops with that error before any information is exported. We both have Office 2007 installed on our computers.
I wondered if it might have something to do with the fact that he was trying to run it from a replica, but I tried it from the replica on my computer and it still worked perfectly.
Here is the portion of the code that seems to be experiencing the problem:
----------------------------------------------
Dim ExcelApp As Excel.Application
Dim ExcelWkb As Excel.Workbook
Dim ExcelWksht As Excel.Worksheet
Dim WorkbookName As String
Dim SheetName As String
'Store the name of the Excel File
WorkbookName = txt_Select_File.Value
'Specify which tab the production statistics should go to
SheetName = "Production Stats"
'Set up and open the Excel application object
Set ExcelApp = New Excel.Application
With ExcelApp
.Visible = True
Set ExcelWkb = .Workbooks.Open(WorkbookName)
Set ExcelWksht = ExcelWkb.Worksheets(SheetName)
End With
------------------------------------------------
Any ideas as to why it would work on my computer and not his?
If you need any additional info in order to help me with this problem, just let me know.
Thanks!
I have a procedure in my database that exports some information from Access 2007 into an Excel spreadsheet. The procedure works perfectly whenever I run it on my computer, but when one of my co-workers tries to run the same procedure on his computer, he gets a "Method 'Open' of object 'Workbooks' failed" error. It opens the spreadsheet, but then stops with that error before any information is exported. We both have Office 2007 installed on our computers.
I wondered if it might have something to do with the fact that he was trying to run it from a replica, but I tried it from the replica on my computer and it still worked perfectly.
Here is the portion of the code that seems to be experiencing the problem:
----------------------------------------------
Dim ExcelApp As Excel.Application
Dim ExcelWkb As Excel.Workbook
Dim ExcelWksht As Excel.Worksheet
Dim WorkbookName As String
Dim SheetName As String
'Store the name of the Excel File
WorkbookName = txt_Select_File.Value
'Specify which tab the production statistics should go to
SheetName = "Production Stats"
'Set up and open the Excel application object
Set ExcelApp = New Excel.Application
With ExcelApp
.Visible = True
Set ExcelWkb = .Workbooks.Open(WorkbookName)
Set ExcelWksht = ExcelWkb.Worksheets(SheetName)
End With
------------------------------------------------
Any ideas as to why it would work on my computer and not his?
If you need any additional info in order to help me with this problem, just let me know.
Thanks!