VBA- Getfile Method

Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: VBA- Getfile Method

  1. #1
    Board Regular
    Join Date
    Jul 2002
    Posts
    92
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA- Getfile Method

     
    I need some VBA help. I am trying to use the getfile method and am looking under the help file. It tells me I need to write a pathspec for the current file I am using, and it says I can make an absolute or relative reference to the file.

    I want to make the pathspec for getfilename refer to this file no matter where it is saved on the hardrive so that the code always works despite location of file saved.

    Writing this pathspec is what I am unsure of. How do I write an absolute or relative reference for the file I am using?

  2. #2
    Board Regular
    Join Date
    Jul 2002
    Posts
    92
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA- Getfile Method

    what I called the pathspec, is really the filespec. sorry for confusion.

  3. #3
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA- Getfile Method

    The current file that you're using, is a workbook ? an addin ? what ? I'm not clear with what you want...
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  4. #4
    Board Regular
    Join Date
    Jul 2002
    Posts
    92
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA- Getfile Method

    it is a workbook that I have 4 colums. When you press a button, it looks in the folder that it is saved in and brings over the file name, the type, the size, and the attributes of any file in the current folder.

    In order to do this, I need a reference to the current workbook file so that no matter where it is saved, it will search the folder and bring in the information to the excel sheet.

    sorry about not being so clear.

  5. #5
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA- Getfile Method

    Ahh.. so maybe what you're looking for is

    ThisWorkbook.Path

    to get the folder in which the workbook is saved ?
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  6. #6
    Board Regular
    Join Date
    Jul 2002
    Posts
    92
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA- Getfile Method

      
    thanx for the help!

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