Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Changing Filename in VBA

Workbooks.Open Filename:="R:\Daily Revenue Report\Daily
Revenue\THKL-DRR.xls"
Sheets("report").Select
ActiveSheet.Unprotect
Windows("drr0107.XLS").Activate

From the code above, every month a new "drrmmyy.xls" file will be created
(where mm = month & yy = year). What codes do I need to write so that the
macro will automatically use the new filename to replace the previous month,
i.e. in feb-07 the new file will be drr0207 and this will replace the drr0107
file in the code above?

Greatly appreciate any and all forms of assistance rendered! Thanx very much
:-)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Changing Filename in VBA

Assuming the file is made within the month it represents:

Dim sFileName as String
sFileName = "drr" & Format(Now, "mmyy") & ".XLS"

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______



"SuperLC" wrote in message
...
Workbooks.Open Filename:="R:\Daily Revenue Report\Daily
Revenue\THKL-DRR.xls"
Sheets("report").Select
ActiveSheet.Unprotect
Windows("drr0107.XLS").Activate

From the code above, every month a new "drrmmyy.xls" file will be created
(where mm = month & yy = year). What codes do I need to write so that the
macro will automatically use the new filename to replace the previous
month,
i.e. in feb-07 the new file will be drr0207 and this will replace the
drr0107
file in the code above?

Greatly appreciate any and all forms of assistance rendered! Thanx very
much
:-)



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
changing the filename in a Link Ben Excel Discussion (Misc queries) 1 August 12th 09 04:20 PM
PivotTables and Changing the FileName [email protected] Excel Programming 0 October 12th 06 10:04 PM
Changing filename fullers Excel Programming 5 February 23rd 06 04:01 PM
Changing Filename when linked to other worksheets Amanda Excel Discussion (Misc queries) 1 October 25th 05 06:06 AM
hyperlinks-changing the filename only! gr8guy Excel Programming 4 May 29th 04 08:29 AM


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