Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default how to save the complete path of the file we open?

Use a variable declared at the top of the code. Put it in a module if you
need global access.
Dim FilePath as string

Then, assuming you are using .GetFileOpenName or something similar:

Dim FileName As String

FileName = Application.GetOpenFilename()
FilePath=Left(FileName, InStrRev(FileName, "\"))

Adjust and add error trapping, depending on your method of file
selection/multi-select etc.

NickHK

"GeneWan" wrote in message
...
eg. my code prompted user to choose the file(s) to be opened within the

same
path. How can I save the path so that I could use it later on?

purpose is so that I can create a file in the same path afterwards..




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default how to save the complete path of the file we open?

thanks nick, works just right! :)


"NickHK" wrote:

Use a variable declared at the top of the code. Put it in a module if you
need global access.
Dim FilePath as string

Then, assuming you are using .GetFileOpenName or something similar:

Dim FileName As String

FileName = Application.GetOpenFilename()
FilePath=Left(FileName, InStrRev(FileName, "\"))

Adjust and add error trapping, depending on your method of file
selection/multi-select etc.

NickHK

"GeneWan" wrote in message
...
eg. my code prompted user to choose the file(s) to be opened within the

same
path. How can I save the path so that I could use it later on?

purpose is so that I can create a file in the same path afterwards..





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
Open Dialog Box to return Selected File Path and Not Open it. DMS Excel Programming 4 January 26th 10 12:46 PM
Want to Set the File Save As path Brenda Excel Programming 1 February 24th 06 03:45 AM
Save to Path & Variable file name Otto Moehrbach[_6_] Excel Programming 4 September 2nd 04 10:44 PM
How set file open path to filepath of file opened with Explorer ? RandyDtg1 Excel Programming 0 May 14th 04 02:05 AM
get path - save new file - same sub-directory as existing file tegger Excel Programming 2 October 21st 03 10:45 AM


All times are GMT +1. The time now is 12:58 AM.

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"