workbooks().open halt

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a command button on a user form to open a series of
workbooks. However, exectution halts after the workbooks
(strFilNme).open line. I am NOT running this from a
shortcut with a shift in it. Is there another command in
VBA to open a workbook so I can work around this?

Thanks,

-John

john.k.hannemann * ual.com

//////
Call OpenWorksheet(strFilNme)
//////

Sub OpenWorksheet(strFilNme As String)

' PURPOSE: Open chart file
' SUBROUTINE FLOW: Change drives/directories to where
' the charts are. Open the requested chart.

On Error GoTo Errhandler
ChDrive "S:"
ChDir "S:\"
ChDir "S:\TRAKTemp\Rolling6\ckin"
Workbooks.Open Filename:=strFilNme, UpdateLinks:=0

Exit Sub

Errhandler:

Select Case Err

Case 68, 75: ' Error 68: "Device not available"
' Error 75: "Path/File Access
Error"
MsgBox "There is an error reading drive B."

Case 76: ' Error 76: "Path not found"
MsgBox "The specified path is not found."

Case Else: ' An error other than 68, 75 or
76 has occurred.
' Display the error number and the error text.
MsgBox "Error # " & Err & " : " & Error(Err)

End Select

' End the macro.
End Sub
 
Hi John,

By "execution halts", do you mean you get an error? Or does VBA just stop
executing?

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
Back
Top