Help Opening file on network

  • Thread starter Thread starter Mikeice
  • Start date Start date
M

Mikeice

HI There

Got some code off the forum here and modified but still can't get t
work.

Private Sub CommandButton3_Click()
Dim sFile As String
Dim Source As Range
Dim Rdest As Range

Set rSource = ThisWorkbook.ActiveSheet.Range("B2:I65")

sFile = ThisWorkbook.Path & "\\Employee\Call Quality\Data.xls"
Workbooks.Open sFile
Set Rdest = ActiveWorkbook.Sheets(1).Range("A1")
rSource.Copy.Rdest
ActiveWorkbook.Close True
End Sub

Comes up with an error and highlights Workbooks.Open sFile

Is it the path?

Gurus help required

Thanks Guys in advance
 
If your file is on a network share as: \\employee\call quality\data.xls

Then change this line:
sFile = ThisWorkbook.Path & "\\Employee\Call Quality\Data.xls"
to just:
sFile = "\\Employee\Call Quality\Data.xls"


If your file is under the folder that contains the workbook that's running the
code:

Then change this line:
sFile = ThisWorkbook.Path & "\\Employee\Call Quality\Data.xls"
to just:
sFile = ThisWorkbook.Path & "\Employee\Call Quality\Data.xls"

(you had an extra backslash.)
 
Back
Top