Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chipshot, what is the value of "C4"?
Greg |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 question involving SaveAs to .XLS | Excel Discussion (Misc queries) | |||
Saveas VBA question | Excel Discussion (Misc queries) | |||
worksheet saveas question | Excel Programming | |||
SaveAs Question | Excel Programming | |||
Question Using SaveAs Method | Excel Programming |