How can I get this to work
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: How can I get this to work

  1. #1
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Christchurch New Zealand
    Posts
    1,030
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I basically want the variable wkbname to act as a directory e.g
    Workbooks.Open Filename:="c:directoryDays Cover.xls"

    this is what I have it doesn't work any help?

    GetDirPath_ThisWorkbook (wkbname)
    ChDir (wkbname)
    Workbooks.Open Filename:=wkbname"Days Cover.xls"


    Public wkbname
    Function GetDirPath_ThisWorkbook(wkbname) As String
    'Returns the path from a filespec
    Dim x As Variant
    x = Split(ThisWorkbook.FullName, Application.PathSeparator)
    ReDim Preserve x(0 To UBound(x) - 1)
    GetDir_ThisWorkbook = Join(x, Application.PathSeparator) & Application.PathSeparator
    wkbname = GetDir_ThisWorkbook
    End Function


  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    London, UK
    Posts
    167
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try:

    Workbooks.Open Filename:=wkbname & "Days Cover.xls"

    or you may need to add a slash if the variable wkbname does not end in one.

  3. #3
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Christchurch New Zealand
    Posts
    1,030
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    thats great thanks I had two &'s and thats why it wouldn't work thanks heaps

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com