Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help Opening file on network


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

--
Mikeic
-----------------------------------------------------------------------
Mikeice's Profile: http://www.excelforum.com/member.php...fo&userid=2246
View this thread: http://www.excelforum.com/showthread.php?threadid=38896

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 253
Default Help Opening file on network

Hi,

You have to change the current drive. Use ChDrive(Path)
Regards
Jean-Yves

"Mikeice" wrote in
message ...

HI There

Got some code off the forum here and modified but still can't get to
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.


--
Mikeice
------------------------------------------------------------------------
Mikeice's Profile:

http://www.excelforum.com/member.php...o&userid=22467
View this thread: http://www.excelforum.com/showthread...hreadid=388968



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Help Opening file on network

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.)

Mikeice wrote:

HI There

Got some code off the forum here and modified but still can't get to
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.

--
Mikeice
------------------------------------------------------------------------
Mikeice's Profile: http://www.excelforum.com/member.php...o&userid=22467
View this thread: http://www.excelforum.com/showthread...hreadid=388968


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Help Opening file on network

Oops. I didn't notice the subject. Try the first suggestion.

Dave Peterson wrote:

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.)

Mikeice wrote:

HI There

Got some code off the forum here and modified but still can't get to
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.

--
Mikeice
------------------------------------------------------------------------
Mikeice's Profile: http://www.excelforum.com/member.php...o&userid=22467
View this thread: http://www.excelforum.com/showthread...hreadid=388968


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help Opening file on network


Thanks guys

You rock!!


Worked perfectly :

--
Mikeic
-----------------------------------------------------------------------
Mikeice's Profile: http://www.excelforum.com/member.php...fo&userid=2246
View this thread: http://www.excelforum.com/showthread.php?threadid=38896

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista opening Excel Files across a network very slowly Daniel Excel Discussion (Misc queries) 1 February 9th 09 06:21 PM
Opening files from Network resource extremely slow LTCol Excel Discussion (Misc queries) 0 November 30th 07 07:05 PM
Opening read-only files on a network Dryzz Excel Discussion (Misc queries) 1 October 10th 07 10:32 PM
excel 2007 opening files on network share Terry Excel Discussion (Misc queries) 0 February 20th 07 01:08 AM
Opening a file in a macro (network) David P. Excel Discussion (Misc queries) 3 June 8th 05 12:35 AM


All times are GMT +1. The time now is 09:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"