#1   Report Post  
Jason
 
Posts: n/a
Default Date

I have a master wookbook that need to update weekly. The new information
comes from a file that sent to me every week(the name of the file changes to
reflect the updated date). I want to use macro to automate this process.
Everything work out fine but I don't know how to change the file name in
macro.

Any advice is highly appreciated.

Jason
  #2   Report Post  
Debra Dalgleish
 
Posts: n/a
Default

You could store the file name in a cell in the macro workbook, and
change or recalculate it as required. For example:

Sub OpenMyFile()
Dim strFilePath As String
Dim strFileName As String

strFilePath = "c:\Data\"
strFileName = Worksheets("Sheet1").Range("A1").Value

Workbooks.Open strFilePath & strFileName

End Sub


Jason wrote:
I have a master wookbook that need to update weekly. The new information
comes from a file that sent to me every week(the name of the file changes to
reflect the updated date). I want to use macro to automate this process.
Everything work out fine but I don't know how to change the file name in
macro.

Any advice is highly appreciated.

Jason



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #3   Report Post  
Jason
 
Posts: n/a
Default

Thanks a lot, Debra.

Jason

"Debra Dalgleish" wrote:

You could store the file name in a cell in the macro workbook, and
change or recalculate it as required. For example:

Sub OpenMyFile()
Dim strFilePath As String
Dim strFileName As String

strFilePath = "c:\Data\"
strFileName = Worksheets("Sheet1").Range("A1").Value

Workbooks.Open strFilePath & strFileName

End Sub


Jason wrote:
I have a master wookbook that need to update weekly. The new information
comes from a file that sent to me every week(the name of the file changes to
reflect the updated date). I want to use macro to automate this process.
Everything work out fine but I don't know how to change the file name in
macro.

Any advice is highly appreciated.

Jason



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


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
extract date from the most current date Cali00 Excel Discussion (Misc queries) 1 April 13th 05 02:05 PM
Date Math Problem Dkline Excel Worksheet Functions 4 March 4th 05 04:11 PM
date and time ladimples247 New Users to Excel 2 February 16th 05 08:52 PM
Date issue between Windows and Macintosh version dlg1967 Excel Discussion (Misc queries) 4 January 19th 05 03:51 PM
Using formulas to determine date in one cell based on date in anot Gary Excel Worksheet Functions 2 November 22nd 04 08:11 AM


All times are GMT +1. The time now is 06:15 AM.

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"