Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Relative path

How do I specify a relative path in vba, to assign to a variable?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Relative path

Relative to what?

Maybe...

Dim myPath as string
dim myPathParent as string

mypath = "C:\my documents\excel\test"
mypathparent = mypath & "\.."

Watch out for that backslash. Include it only one location.



Perico wrote:

How do I specify a relative path in vba, to assign to a variable?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Relative path

It isn't clear what you are trying to accomplish, but you can use "..\" to
get a parent folder. E.g.,

ChDir "C:\Test\Sub1\SubSub1"
Debug.Print Dir("..\..\Sub1\Test.txt", vbNormal)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Perico" wrote in message
...
How do I specify a relative path in vba, to assign to a variable?


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
Relative Path to a Folder Heliocracy Excel Discussion (Misc queries) 3 October 3rd 07 04:28 PM
how to change absolute path to relative path hwijgerse Excel Worksheet Functions 0 November 25th 05 07:18 AM
Relative path Giovaz Excel Programming 3 July 13th 04 02:21 PM
SaveAs and relative path dev[_2_] Excel Programming 2 December 19th 03 02:50 PM
relative path. Bob Kilmer Excel Programming 0 September 12th 03 12:25 AM


All times are GMT +1. The time now is 03:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"