Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default Relative Path to a Folder

I have a workbook containing a macro which combines the contents of several
workbooks that are in a sub-folder of the folder in which the combiner
resides. The macro uses the following code to identify the path to the
subfolder containing the workbooks to be combined:

Sub Filter_Data()
Get_File_Names _
MyPath:="C:\Documents and Settings\mtn1\Desktop\Test
Folder\Templates", _
Subfolders:=False, _
ExtStr:="*.xl*"

My problem is this: It's going to be on a network, and not all users will
have the same drive letter mapped. I have investigated relative paths, but
all the examples I've seen are paths to a specific filename in the target
folder. How can I tell the macro to look for workbooks in a subfolder of the
folder that contains the macro, without using that folder's absolute path?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Relative Path to a Folder

Try this and change the 1.2.3.4 to your network IP
\\1.2.3.4\Documents and Settings\mtn1\Desktop\Test\Folder\Templates

"Heliocracy" wrote:

I have a workbook containing a macro which combines the contents of several
workbooks that are in a sub-folder of the folder in which the combiner
resides. The macro uses the following code to identify the path to the
subfolder containing the workbooks to be combined:

Sub Filter_Data()
Get_File_Names _
MyPath:="C:\Documents and Settings\mtn1\Desktop\Test
Folder\Templates", _
Subfolders:=False, _
ExtStr:="*.xl*"

My problem is this: It's going to be on a network, and not all users will
have the same drive letter mapped. I have investigated relative paths, but
all the examples I've seen are paths to a specific filename in the target
folder. How can I tell the macro to look for workbooks in a subfolder of the
folder that contains the macro, without using that folder's absolute path?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Relative Path to a Folder

Try:

MyPath:= ThisWorkbook.Path etc...

HTH,
Bernie
MS Excel MVP


"Heliocracy" wrote in message
...
I have a workbook containing a macro which combines the contents of several
workbooks that are in a sub-folder of the folder in which the combiner
resides. The macro uses the following code to identify the path to the
subfolder containing the workbooks to be combined:

Sub Filter_Data()
Get_File_Names _
MyPath:="C:\Documents and Settings\mtn1\Desktop\Test
Folder\Templates", _
Subfolders:=False, _
ExtStr:="*.xl*"

My problem is this: It's going to be on a network, and not all users will
have the same drive letter mapped. I have investigated relative paths, but
all the examples I've seen are paths to a specific filename in the target
folder. How can I tell the macro to look for workbooks in a subfolder of the
folder that contains the macro, without using that folder's absolute path?



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default Relative Path to a Folder

Yep, I stumbled on this solution about two minutes after asking the question
lol...

Thanks to all for your help.

Mike

"Bernie Deitrick" wrote:

Try:

MyPath:= ThisWorkbook.Path etc...

HTH,
Bernie
MS Excel MVP


"Heliocracy" wrote in message
...
I have a workbook containing a macro which combines the contents of several
workbooks that are in a sub-folder of the folder in which the combiner
resides. The macro uses the following code to identify the path to the
subfolder containing the workbooks to be combined:

Sub Filter_Data()
Get_File_Names _
MyPath:="C:\Documents and Settings\mtn1\Desktop\Test
Folder\Templates", _
Subfolders:=False, _
ExtStr:="*.xl*"

My problem is this: It's going to be on a network, and not all users will
have the same drive letter mapped. I have investigated relative paths, but
all the examples I've seen are paths to a specific filename in the target
folder. How can I tell the macro to look for workbooks in a subfolder of the
folder that contains the macro, without using that folder's absolute path?




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
Setting a path to a folder Boots Excel Discussion (Misc queries) 2 August 10th 06 02:14 PM
Using Relative path for XML data file? Mark W. Robbins Charts and Charting in Excel 0 June 7th 06 06:41 AM
Browse button on form for folder path Greshter Excel Discussion (Misc queries) 2 January 12th 06 10:20 PM
how to change absolute path to relative path hwijgerse Excel Worksheet Functions 0 November 25th 05 07:18 AM
Absolute vs Relative path K2H Excel Discussion (Misc queries) 2 July 28th 05 12:50 PM


All times are GMT +1. The time now is 01:03 PM.

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"