Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default File name being changed

In 2003 Excel VBA, this code saved the name correctly:

Application.Calculation = xlCalculationAutomatic
ChDir "K:"

wNFileName = "k:Safety\" & Left(wFileName, Len(wFileName) - 4) & " " &
Format(Now(), "mmddyy") & ".xls"
ActiveWorkbook.SaveAs FileName:=wNFileName
ActiveWorkbook.Close
ChDir ".."
ActiveWorkbook.SaveAs FileName:="k:" & wFileName

So a file name of "Quota File MW 201003.xls" would save with exactly that
filename.

Just upgraded to 2007 and same code now saves

"Quota%20File%20MW%20201003.xls" which I assume is URL encoding. How can I
turn that off, or have Excel 2007 revert back to 2003 behavior??

Thanks!!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default File name being changed

Hi Bbotz,

I would replace all spaces " " with an underscore "_".
So you would get "Quota_File_MW_201003.xls", using

ActiveWorkbook.SaveAs FileName:=Replace(wNFileName, " ", "_")

Besides I see something strange in this part: "k:Safety\"
TMHO it should be "k:\Safety\"

HTH,

Wouter
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default File name being changed

Can anyone please help with this???

"bbotz" wrote:

In 2003 Excel VBA, this code saved the name correctly:

Application.Calculation = xlCalculationAutomatic
ChDir "K:"

wNFileName = "k:Safety\" & Left(wFileName, Len(wFileName) - 4) & " " &
Format(Now(), "mmddyy") & ".xls"
ActiveWorkbook.SaveAs FileName:=wNFileName
ActiveWorkbook.Close
ChDir ".."
ActiveWorkbook.SaveAs FileName:="k:" & wFileName

So a file name of "Quota File MW 201003.xls" would save with exactly that
filename.

Just upgraded to 2007 and same code now saves

"Quota%20File%20MW%20201003.xls" which I assume is URL encoding. How can I
turn that off, or have Excel 2007 revert back to 2003 behavior??

Thanks!!

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
File References have changed DVENNER Excel Discussion (Misc queries) 1 September 11th 07 03:18 PM
why is absolute hyperlink in XLS file changed when file is saved SusanJ Excel Discussion (Misc queries) 3 August 17th 07 02:24 AM
How to make a routine that will automatically print a word file after it has been changed via an ole link to an excel file? Starriol Excel Programming 0 November 3rd 05 11:59 AM
Excel is not asking to save a changed file when the file is closed Ron Excel Discussion (Misc queries) 2 March 14th 05 01:05 AM
Event for a file being changed? R Avery Excel Programming 2 August 3rd 04 01:43 PM


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