I have a workbook that will open and if certain condtions are meet will open another workbook and run a specific module. I can get this to work when I use the drive letter but I would like to use the serve name instead. Any ideas. My first example is using the drive letter and it works. My second example is using the server name and it is not working. I get a run-time error'1004': The macro "//buying/share/share/MPA/ALL/MIO/Code Changes/Kitchen Sink/UpdateVersion1.xls'!current' cannot be found.
Example that works with drive letters
Example that does not work with server names.
Example that works with drive letters
Code:
Dim strFilePath As String, strFilePath2 As String
strFilePath = "G:\share\MPA\ALL\MIO\Code Changes\Kitchen Sink\UpdateVersion1.xls"
strFilePath2 = "G:/share/MPA/ALL/MIO/Code Changes/Kitchen Sink/UpdateVersion1.xls"
If Dir(strFilePath, vbDirectory) = vbNullString Then
strFilePath = "Q:\share\MPA\ALL\MIO\Code Changes\Kitchen Sink\UpdateVersion1.xls"
strFilePath2 = "Q:/share/MPA/ALL/MIO/Code Changes/Kitchen Sink/UpdateVersion1.xls"
If Dir(strFilePath, vbDirectory) = vbNullString Then
MsgBox ("Code update was not successful. Please contact MIO.Business Solutions.")
GoTo Finish
End If
End If
Set mcro = Workbooks.Open(strFilePath, False)
changedwb.Activate
Application.Run "'" & strFilePath2 & "'!current"
mcro.Close False
GoTo Finish
Example that does not work with server names.
Code:
Dim strFilePath As String, strFilePath2 As String
strFilePath = "\\buying\share\share\MPA\ALL\MIO\Code Changes\Kitchen Sink\UpdateVersion1.xls"
strFilePath2 = "//buying/share/share/MPA/ALL/MIO/Code Changes/Kitchen Sink/UpdateVersion1.xls"
If Dir(strFilePath, vbDirectory) = vbNullString Then
MsgBox ("Code update was not successful. Please contact MIO.Business Solutions.")
GoTo Finish
End If
Set mcro = Workbooks.Open(strFilePath, False)
changedwb.Activate
Application.Run "'" & strFilePath2 & "'!current"
mcro.Close False
GoTo Finish