If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Workbooks.Open method fails in VBA

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-24-05, 07:05
justin_tighe justin_tighe is offline
Registered User
 
Join Date: Nov 2003
Location: LONDON
Posts: 236
Workbooks.Open method fails in VBA

Hi,

I am trying to open an Excel spreadsheet from Access using the following code in Access:

Private mobjXL As Excel.Application

Private Sub cmdImportFiles_Click()
Dim wrk As Excel.Workbook
Set mobjXL = New Excel.Application
With mobjXL
.ScreenUpdating = False
.Visible = false
.DisplayAlerts = False
Set wrk = mobjXL.Workbooks.Open("Excel file path and name")
' Do something with the Excel spreadsheet
End With
' error handler
End Sub

I keep getting an error message of 'Method 'Open' of object Workbook failed' everytime Excel tries to open the spreadsheet (and it can be any spreadsheet). Any suggestions on how to open the Excel spreadsheet in VBA without the error message?

Regards
Justin
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On