Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Using a file name to get the path where the file resides

I printing reports from 4 different files who names change each month
depending on the month and version

I would like to enter the file name in a cell in the worksheet. Then have
the VBA code search and return the path where the file exist

--
Helping Is always a good thing
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Using a file name to get the path where the file resides

See:

http://groups.google.com/group/micro...718b529f0a6e60


--
Gary's Student


"QuietMan" wrote:

I printing reports from 4 different files who names change each month
depending on the month and version

I would like to enter the file name in a cell in the worksheet. Then have
the VBA code search and return the path where the file exist

--
Helping Is always a good thing

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Using a file name to get the path where the file resides

Gary,

thsi opens up a dialog box where the person would have to select the file

I want the code to search for the path based on the file name inputed in a
cell in the worksheet

--
Helping Is always a good thing


"Gary''s Student" wrote:

See:

http://groups.google.com/group/micro...718b529f0a6e60


--
Gary's Student


"QuietMan" wrote:

I printing reports from 4 different files who names change each month
depending on the month and version

I would like to enter the file name in a cell in the worksheet. Then have
the VBA code search and return the path where the file exist

--
Helping Is always a good thing

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Using a file name to get the path where the file resides

Try this:


Sub gsnu()
Dim s0 As String
Dim s1 As String
Dim s2 As String
Dim s3 As String
Dim s4 As String

s0 = "cd\"
s1 = "findit.bat"
s2 = "dir /s "
s3 = Range("A1").Value
s4 = "pause"

Open s1 For Output As #1
Print #1, s0
Print #1, s2 & s3
Print #1, s4
Close #1

x = Shell("cmd.exe /c findit.bat", 1)

End Sub

This routine uses the contents of cell A1 to create a .bat file. The
routine then executes the .bat file. The .bat file uses the dir command to
do the searching.
--
Gary''s Student


"QuietMan" wrote:

Gary,

thsi opens up a dialog box where the person would have to select the file

I want the code to search for the path based on the file name inputed in a
cell in the worksheet

--
Helping Is always a good thing


"Gary''s Student" wrote:

See:

http://groups.google.com/group/micro...718b529f0a6e60


--
Gary's Student


"QuietMan" wrote:

I printing reports from 4 different files who names change each month
depending on the month and version

I would like to enter the file name in a cell in the worksheet. Then have
the VBA code search and return the path where the file exist

--
Helping Is always a good thing

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
Variabilize File Path or File Name in SumProduct (and Vlookup too) Mike H. Excel Worksheet Functions 2 January 7th 08 09:34 PM
Formula too long - new file path is shorter than old file path - Excel 2003 Greg J Excel Worksheet Functions 1 November 22nd 06 05:16 PM
Excel updating from XML file - file path specific? Sean Excel Discussion (Misc queries) 4 August 5th 05 12:56 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 07:39 PM.

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"