ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ActiveWorkbook.SaveAs problem (https://www.excelbanter.com/excel-programming/345548-activeworkbook-saveas-problem.html)

SandyUK[_11_]

ActiveWorkbook.SaveAs problem
 

This should be obvious to me but I am having one of those days.

The code below saves the file as

R:\Cost\Development\Requote\mtxtSaveName.xls

where what i am actually trying to achieve is that it saves as the
result of mtxtSaveName to R:\Cost\Development\Requote

Any help would be appreciated

Regards

Adrian


Sub InsertDateAndSave()
'

Dim mtxtCustomerName As String
Dim mtxtBqName As String
Dim mtxtFcode As String
Dim mtxtRequoteDate As String
Dim mtxtSaveName As Variant

Range("B5").Select
ActiveCell.FormulaR1C1 = "=NOW()"
Range("B5").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

mtxtCustomerName = Range("B6")
mtxtBqName = Range("B8")
mtxtFcode = Range("B7")
mtxtRequoteDate = Range("B5")

mtxtSaveName = (mtxtCustomerName & " " & mtxtBqName & " " & mtxtFcode
_
& " " & mtxtRequoteDate)


ActiveWorkbook.SaveAs Filename:= _
"R:\Cost\Development\Requote\mtxtSaveName.xls" ,
FileFormat:=xlNormal _
, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, _
CreateBackup:=False



End Sub


--
SandyUK
------------------------------------------------------------------------
SandyUK's Profile: http://www.excelforum.com/member.php...o&userid=17487
View this thread: http://www.excelforum.com/showthread...hreadid=484845


Kalpesh[_2_]

ActiveWorkbook.SaveAs problem
 
Sandy

How about ActiveWorkbook.SaveAs Filename:= _
"R:\Cost\Development\Requote\" + mtxtSaveName + ".xls",

Here, it will replace the value of mtxtSaveName with the content of the
variable

Does this help?
Kalpesh


SandyUK[_12_]

ActiveWorkbook.SaveAs problem
 

Thanks for the response i had tried + and & with no joy but after a cu
of coffee and a deep breath i tried a new search string on the site an
think i have found my answer.

Adria

--
SandyU
-----------------------------------------------------------------------
SandyUK's Profile: http://www.excelforum.com/member.php...fo&userid=1748
View this thread: http://www.excelforum.com/showthread.php?threadid=48484



All times are GMT +1. The time now is 04:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com