Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Another SaveAs Question


In the code below I cannot get the saveas that uses the variable driven
filename to save. It executes without error and the correct value is
shown in the message box and if I use the debugger the correct value is
in the strFilename variable but nothing is saved. However the hardcoded
filename saves fine. Is there anything I might be overlooking in terms
of application settings or anything I am overlooking? I have two
similar verions. It works in one but not the other.

Dim strFilename as String
strFilename = Range("c4") & ".xls"


With ActiveWorkbook
msgbox strFilename
.SaveAs FileName:="C:\Pricing Model\" & strfilename
.SaveAs FileName:="C:\Pricing Model\test.xls"
.Close False
End With



--
chipshot
------------------------------------------------------------------------
chipshot's Profile: http://www.excelforum.com/member.php...o&userid=27701
View this thread: http://www.excelforum.com/showthread...hreadid=530964

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Another SaveAs Question


Bueller?....................


--
chipshot
------------------------------------------------------------------------
chipshot's Profile: http://www.excelforum.com/member.php...o&userid=27701
View this thread: http://www.excelforum.com/showthread...hreadid=530964

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Another SaveAs Question

Did you look in that Pricing Model folder for a file that has a name that
matches strfilename?

Your back-to-back .saveAs would leave test.xls as the activeworkbook.

If that doesn't work, you may want to post your actual code.

chipshot wrote:

In the code below I cannot get the saveas that uses the variable driven
filename to save. It executes without error and the correct value is
shown in the message box and if I use the debugger the correct value is
in the strFilename variable but nothing is saved. However the hardcoded
filename saves fine. Is there anything I might be overlooking in terms
of application settings or anything I am overlooking? I have two
similar verions. It works in one but not the other.

Dim strFilename as String
strFilename = Range("c4") & ".xls"


With ActiveWorkbook
msgbox strFilename
.SaveAs FileName:="C:\Pricing Model\" & strfilename
.SaveAs FileName:="C:\Pricing Model\test.xls"
.Close False
End With


--
chipshot
------------------------------------------------------------------------
chipshot's Profile: http://www.excelforum.com/member.php...o&userid=27701
View this thread: http://www.excelforum.com/showthread...hreadid=530964


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Another SaveAs Question


I just put them back to back to show which one works and which one
doesn't. It does the same thing when the directory is empty. If I take
out the hard coded line it makes no differance.


--
chipshot
------------------------------------------------------------------------
chipshot's Profile: http://www.excelforum.com/member.php...o&userid=27701
View this thread: http://www.excelforum.com/showthread...hreadid=530964

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Another SaveAs Question

You may want to post your actual code.

And what's in that cell.

chipshot wrote:

I just put them back to back to show which one works and which one
doesn't. It does the same thing when the directory is empty. If I take
out the hard coded line it makes no differance.

--
chipshot
------------------------------------------------------------------------
chipshot's Profile: http://www.excelforum.com/member.php...o&userid=27701
View this thread: http://www.excelforum.com/showthread...hreadid=530964


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Another SaveAs Question

Chipshot, what is the value of "C4"?

Greg

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Another SaveAs Question

from what I can see, if everything is fine, it should work. If it doesn't
work, something must not be fine. does the value of strfilename have the
extension ".xls"?

--
Regards,
Tom Ogilvy


"chipshot" wrote:


In the code below I cannot get the saveas that uses the variable driven
filename to save. It executes without error and the correct value is
shown in the message box and if I use the debugger the correct value is
in the strFilename variable but nothing is saved. However the hardcoded
filename saves fine. Is there anything I might be overlooking in terms
of application settings or anything I am overlooking? I have two
similar verions. It works in one but not the other.

Dim strFilename as String
strFilename = Range("c4") & ".xls"


With ActiveWorkbook
msgbox strFilename
.SaveAs FileName:="C:\Pricing Model\" & strfilename
.SaveAs FileName:="C:\Pricing Model\test.xls"
.Close False
End With



--
chipshot
------------------------------------------------------------------------
chipshot's Profile: http://www.excelforum.com/member.php...o&userid=27701
View this thread: http://www.excelforum.com/showthread...hreadid=530964


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Another SaveAs Question


I've done it with it there and without it. Thing is when it's hard coded
it will work with or without the .xls extension as well, it
automatically appends it. I'm thinking it really isn't a coding issue
but some other unknown quirk.


--
chipshot
------------------------------------------------------------------------
chipshot's Profile: http://www.excelforum.com/member.php...o&userid=27701
View this thread: http://www.excelforum.com/showthread...hreadid=530964

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
Excel 2007 question involving SaveAs to .XLS Kirk Bubul Excel Discussion (Misc queries) 3 October 17th 09 03:01 PM
Saveas VBA question Lost Excel Discussion (Misc queries) 1 June 2nd 09 07:51 AM
worksheet saveas question Jim Rech Excel Programming 1 March 30th 05 08:50 PM
SaveAs Question Greg Little Excel Programming 3 December 7th 04 02:37 AM
Question Using SaveAs Method R3df1sh Excel Programming 1 November 12th 03 07:26 PM


All times are GMT +1. The time now is 11:56 PM.

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"