+ Reply to Thread
Results 1 to 7 of 7

XL doesn't like my path?

  1. #1
    davegb
    Guest

    XL doesn't like my path?

    I'm trying to tell XL which workbook to use:

    Set wbOrig = H:\AllDocs\CFSR PIP DD\SFY 06 Q1\Records Base\Abuse in
    Care original.xls

    but it doesn't like my backslash. I searched in the NG, but couldn't
    find a similar example. So how do I tell it the path and workbook name?

    Thanks!


  2. #2
    Dave Peterson
    Guest

    Re: XL doesn't like my path?

    If wbOrig is a string, then you don't need Set:

    wbOrig _
    = "H:\AllDocs\CFSR PIP DD\SFY 06 Q1\Records Base\Abuse in Care original.xls"

    And you need double quotes around the string.

    If wbOrig is a workbook object:

    Dim OrigName as string
    dim OrigWkbk as workbook 'I like more info in the variables

    OrigName _
    = "H:\AllDocs\CFSR PIP DD\SFY 06 Q1\Records Base\Abuse in Care original.xls"

    set OrigWkbk = workbooks.open(filename:=origname)


    davegb wrote:
    >
    > I'm trying to tell XL which workbook to use:
    >
    > Set wbOrig = H:\AllDocs\CFSR PIP DD\SFY 06 Q1\Records Base\Abuse in
    > Care original.xls
    >
    > but it doesn't like my backslash. I searched in the NG, but couldn't
    > find a similar example. So how do I tell it the path and workbook name?
    >
    > Thanks!


    --

    Dave Peterson

  3. #3
    Kletcho
    Guest

    Re: XL doesn't like my path?

    set wbOrig = Workbooks.Open(filename:="H:\AllDocs\CFSR PIP DD\SFY 06
    Q1\Records Base\Abuse in
    Care original.xls")


  4. #4
    Kletcho
    Guest

    Re: XL doesn't like my path?

    Or if it is already open
    set wbOrig = Workbooks("H:\AllDocs\CFSR PIP DD\SFY 06 Q1\Records
    Base\Abuse in Care original.xls")


  5. #5
    Gary Keramidas
    Guest

    Re: XL doesn't like my path?

    i'll just use something like this:

    dim fPath as string
    dim fName as string

    fPath = "N:\My Documents\Excel\"
    fName = fName = "Abuse in Care original.xls"

    Workbooks.Open Filename:=fPath & fName

    --


    Gary

    "davegb" <[email protected]> wrote in message
    news:[email protected]...
    > I'm trying to tell XL which workbook to use:
    >
    > Set wbOrig = H:\AllDocs\CFSR PIP DD\SFY 06 Q1\Records Base\Abuse in
    > Care original.xls
    >
    > but it doesn't like my backslash. I searched in the NG, but couldn't
    > find a similar example. So how do I tell it the path and workbook name?
    >
    > Thanks!
    >



  6. #6
    Dave Peterson
    Guest

    Re: XL doesn't like my path?

    If it's already open, you can't have the path:

    set wbOrig = Workbooks("Abuse in Care original.xls")



    Kletcho wrote:
    >
    > Or if it is already open
    > set wbOrig = Workbooks("H:\AllDocs\CFSR PIP DD\SFY 06 Q1\Records
    > Base\Abuse in Care original.xls")


    --

    Dave Peterson

  7. #7
    davegb
    Guest

    Re: XL doesn't like my path?


    Dave Peterson wrote:
    > If wbOrig is a string, then you don't need Set:
    >
    > wbOrig _
    > = "H:\AllDocs\CFSR PIP DD\SFY 06 Q1\Records Base\Abuse in Care original.xls"
    >
    > And you need double quotes around the string.
    >
    > If wbOrig is a workbook object:
    >
    > Dim OrigName as string
    > dim OrigWkbk as workbook 'I like more info in the variables
    >
    > OrigName _
    > = "H:\AllDocs\CFSR PIP DD\SFY 06 Q1\Records Base\Abuse in Care original.xls"
    >
    > set OrigWkbk = workbooks.open(filename:=origname)
    >
    >
    > davegb wrote:
    > >
    > > I'm trying to tell XL which workbook to use:
    > >
    > > Set wbOrig = H:\AllDocs\CFSR PIP DD\SFY 06 Q1\Records Base\Abuse in
    > > Care original.xls
    > >
    > > but it doesn't like my backslash. I searched in the NG, but couldn't
    > > find a similar example. So how do I tell it the path and workbook name?
    > >
    > > Thanks!

    >
    > --
    >
    > Dave Peterson


    Thanks everyone! I should have mentioned that wbOrig is a workbook
    object. Got it worked out!


+ 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