LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default A way of capturing the new path a file is stored in

Dear John

Suggest you to use the FilePicker....try the below

Sub Mac()
Dim fd As FileDialog
Dim strFile As String
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
..Filters.Add "Excel Files", "*.xls"
..AllowMultiSelect = False
If .Show Then strFile = .SelectedItems(1)
End With

MsgBox strFile
End Sub
--
If this post helps click Yes
---------------
Jacob Skaria


"John" wrote:

Hi,

I'm trying to find a way to programatically return the path of a file.
Currently the path(s) are hard coded in the code. I would like to be able to
store the new path based on the user selecting the file in the new location:

In VBA i run a procedure that opens a file based on a hard coded path. As
the file exists in another folder Excel tells me it cant find the file.

So i would like to give the user the option to point to the new location of
the file.
When that file is selected, Excel writes the location of the new path into
the code.
Is this possible in VBA, and if so, how would i code this please?

Thanks for helping me out with this.
Regards,
John

 
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
FYI: One macro really helped for capturing data from multiple workbook stored in a specific folder to one excel file only Smits Excel Programming 0 November 8th 06 04:37 AM
Capturing current folder path DKS Excel Programming 2 August 14th 06 11:34 AM
Place Stored Path Into Formulla ken8795 Excel Discussion (Misc queries) 1 July 23rd 06 01:46 PM
Capturing a file path Daniel Bonallack Excel Programming 2 June 24th 05 08:14 PM
Capturing a file path Daniel Bonallack[_5_] Excel Programming 1 October 18th 04 11:10 PM


All times are GMT +1. The time now is 09:37 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"