Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Working with directories question

I would like to have amacro that follows a path until it gets to the "Month"
Subfolder. At this point it would check the month against the month in the
folder name and open the releated subfolder where a file will exist that I
would open in much the same way.

Is it possible? What do I need to get started?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Working with directories question

Hi Helen,
this is a fairly simple method to do what you want. There are more
complex methods to browse each folder in a directory, but this should
get you pointed in the right direction:

Dim folderDate, myDir, myFile, myDirFile As String
'myDir = the directory where the date folder lies
'with folderDate you will need whatever logic
'to derive the naming methodoligy
'myFile = "yourfilename.xls"
myDirFile = myDir & "\" & folderDate & "\" & myFile
Workbooks.Open Filename:=myDirFile, UpdateLinks:=0

If you need more help with the date folder logic please post more
information on the convention used to name it and when the date folder
is added / changes.
HTH--Lonnie M.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Working with directories question

Do you not know where the month folder is?

if you do

sPath = "C:\mysubfolder1\mysubfolder2\" & format(Date,"mmmm") & "\"

workbooks.Open sPath & Format(Date,"yyyymmdd.xls")

Adjust the Format(Date, . . . ) part to reflect the naming convention for
your file.

--
Regards,
Tom Ogilvy




"Helen" wrote in message
...
I would like to have amacro that follows a path until it gets to the

"Month"
Subfolder. At this point it would check the month against the month in the
folder name and open the releated subfolder where a file will exist that

I
would open in much the same way.

Is it possible? What do I need to get started?



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
Stop Excel from locking files/directories you AREN'T working on? Your Display Name here... Excel Discussion (Misc queries) 1 November 20th 09 01:14 AM
sub directories again Shailesh Shah[_2_] Excel Programming 5 February 9th 04 09:32 PM
sub directories again Mike[_67_] Excel Programming 2 February 7th 04 12:06 AM
sub directories Mike Excel Programming 5 February 6th 04 10:15 PM
Directories Jeff[_24_] Excel Programming 4 January 20th 04 09:26 AM


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