Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Hard-Coding a File Location

I have Excel files in a directory on the network that I want to be updated
even if they are moved WITHIN the SAME directory but say.....in another
subfolder. Right now, they are dependent on each other so I have the
location of them hard-coded . But if I move ONE, Excel wont be able to find
it. How can I not hard-code the location but still have them be able to find
each other?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Hard-Coding a File Location

Your gonna have use a filesearch in your code like this

Dim FCnt As Integer, MyFilePath As String, Fs As FileSearc
Set Fs = Application.FileSearc
With F
.LookIn = "C:\
.Filename = "MyFileName.xls
.FileType = msoFileTypeExcelWorkbook
.SearchSubFolders = Tru
If .Execute() 0 The
FCnt = .FoundFiles.Coun
MyFilePath = .FoundFiles(FCnt
Els
MsgBox "MyFileName could not be found!
Exit Su
End I
End With
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
How to close a excel file using Macro coding? Eric Excel Worksheet Functions 5 June 11th 07 03:02 PM
When I save a file on the hard-drive, it is fine, I can re-open, help Excel Discussion (Misc queries) 2 October 4th 06 10:13 PM
how do i find a deleted file on my hard drive karik Excel Discussion (Misc queries) 5 June 24th 06 11:22 AM
hard coding a cell darrelly Excel Discussion (Misc queries) 2 October 7th 05 11:24 PM
Need some help with in coding!!!! text file importing SUDHENDRA Excel Programming 4 December 7th 03 02:15 PM


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