Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ed ed is offline
external usenet poster
 
Posts: 59
Default Time to learn to find the right folder *sigh*

"Don't hardcode your filepaths" I was told. "But it's only ever going to be on my machine!" I said. Well, it will *still* be only my machine - when IT gives it back, that it. Yesterday, WHAM! and CRASH! Data's good, but tomorrow I get it back with XP and a whole new set-up. *Now* where are my folders and files?!? asks my macros

I can either visit each macro as it errors and hardcode new paths, setting myself up once again for running face-first into brick walls I was told were there! Or I can put a command to the Open dialog and Browse each time - but I have better things to do. Or I can learn how to tell my code to search and find a certain folder or file. I know this means haing to name folders and files in an easily-recognized manner (vice NewFolder2, NewFolder3, Stuff, OldStuff, and other originalities)

*sigh* Okay - where do I start? A drop-kick in the right direction is appreciated

Ed
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Time to learn to find the right folder *sigh*

Hi Ed,

Here are a couple of snippets to get you going.

' Determine if Parthenon\release is mapped on the local machine
Dim fs, d, dc, s, n
Set fs = CreateObject("Scripting.FileSystemObject")
Set dc = fs.Drives
MyDrive = "null"
For Each d In dc
If d.sharename = "\\Parthenon\release" Then
MyDrive = d.Path
Exit For
ElseIf d.sharename = "\\PARTHENON\release" Then
MyDrive = d.Path
Exit For
ElseIf d.sharename = "\\PARTHENON\Release" Then
MyDrive = d.Path
Exit For
ElseIf d.sharename = "\\PARTHENON\RELEASE" Then
MyDrive = d.Path
Exit For
ElseIf d.sharename = "\\Parthenon\Release" Then
MyDrive = d.Path
Exit For
ElseIf d.sharename = "\\parthenon\release" Then
MyDrive = d.Path
Exit For
End If
Next


Sub ShowFinalActive()
Dim fs, f, f1, fc, s, sf
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder("P:\Data\Final\")
Set fc = f.files
For Each f1 In fc
If Left(f1.datelastmodified, Len(Date)) = Str(Date) Then
s = s & f1.Name & vbTab & f1.datelastmodified
s = s & vbCrLf & vbCrLf
End If
Next
MsgBox s, , "Final inspection files modified today"
End Sub

HTH, Greg
"Ed" wrote in message
...
"Don't hardcode your filepaths" I was told. "But it's only ever going to

be on my machine!" I said. Well, it will *still* be only my machine - when
IT gives it back, that it. Yesterday, WHAM! and CRASH! Data's good, but
tomorrow I get it back with XP and a whole new set-up. *Now* where are my
folders and files?!? asks my macros!

I can either visit each macro as it errors and hardcode new paths, setting

myself up once again for running face-first into brick walls I was told were
there! Or I can put a command to the Open dialog and Browse each time - but
I have better things to do. Or I can learn how to tell my code to search
and find a certain folder or file. I know this means haing to name folders
and files in an easily-recognized manner (vice NewFolder2, NewFolder3,
Stuff, OldStuff, and other originalities).

*sigh* Okay - where do I start? A drop-kick in the right direction is

appreciated.

Ed



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
I had to be handed this one.... (sigh) urBrothaFromAnothaMotha Excel Discussion (Misc queries) 1 April 9th 07 03:42 AM
using excel for the first time,want a document frowhere can learn pooja thimmaiah New Users to Excel 3 March 31st 06 08:42 PM
What is folder OLK7 and where can I find it? HELP! Excel Discussion (Misc queries) 1 April 1st 05 05:35 AM
Find folder macro was in Fred Smith Excel Programming 4 March 3rd 04 04:13 AM
find if there is a particular folder in a path nikolaosk[_11_] Excel Programming 2 October 20th 03 08:22 AM


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