I have a code that seems to work on some PCs and not on others. All PCs are running 2007. Files can be on PC or network drives. Essentially the code error occurs at ChDrive (Left(.DefaultFilePath, 1)). I step into the code. When I get to ChDrive (Left(.DefaultFilePath, 1)), error on some PCs. Below is a partial of the code. I cannot figure out what is causing this error.
Private Sub CommandButton119_Click()
Dim Filter As String, Title As String
Dim File As String
Dim FilterIndex As Integer
Dim Filename As Variant
Dim curWB As Workbook, destWB As Workbook
Dim ws As Worksheet, bFound As Boolean
Set curWB = ActiveWorkbook
With Application
'Set Password
PWORD = "1111"
End With
'Unprotect active sheet with password.
Unprotect PWORD
' File filters
Filter = "Excel Files (*.xls),*.xls," & _
"Text Files (*.txt),*.txt," & _
"All Files (*.*),*.*"
' Default Filter to *.*
FilterIndex = 3
' Set Dialog Caption
Title = "Select a File to Open"
' Select Start Drive & Path
ChDrive ("")
With Application
' Set File Name to selected File
Private Sub CommandButton119_Click()
Dim Filter As String, Title As String
Dim File As String
Dim FilterIndex As Integer
Dim Filename As Variant
Dim curWB As Workbook, destWB As Workbook
Dim ws As Worksheet, bFound As Boolean
Set curWB = ActiveWorkbook
With Application
'Set Password
PWORD = "1111"
End With
'Unprotect active sheet with password.
Unprotect PWORD
' File filters
Filter = "Excel Files (*.xls),*.xls," & _
"Text Files (*.txt),*.txt," & _
"All Files (*.*),*.*"
' Default Filter to *.*
FilterIndex = 3
' Set Dialog Caption
Title = "Select a File to Open"
' Select Start Drive & Path
ChDrive ("")
With Application
' Set File Name to selected File