+ Reply to Thread
Results 1 to 5 of 5

Help Opening file on network

  1. #1
    Registered User
    Join Date
    04-20-2005
    Posts
    52

    Help Opening file on network

    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.

  2. #2
    Jean-Yves
    Guest

    Re: Help Opening file on network

    Hi,

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

    "Mikeice" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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. #3
    Dave Peterson
    Guest

    Re: 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. #4
    Dave Peterson
    Guest

    Re: 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. #5
    Registered User
    Join Date
    04-20-2005
    Posts
    52

    Thank You

    Thanks guys

    You rock!!


    Worked perfectly

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1