Goffer
Goffer

Reputation: 400

Saving the document

How to enter a variable into the code correctly so that the saved document has a name, which is located in cell A1

ActiveWorkbook.XmlMaps("Pi").Export Url:="C:\Users\nico\Desktop\A1.XML"

Upvotes: 0

Views: 40

Answers (1)

Kuba Do
Kuba Do

Reputation: 155

Option Explicit 

Sub SaveMe() 
     'Saves filename as value of A1 

    Dim newFile As String, fName As String 
    fName = Range("A1").Value 
    newFile = fName 

    ChDir _ 
    "C:\Users\nico\Desktop\" 
    ActiveWorkbook.SaveAs Filename:=newFile 

End Sub

Upvotes: 2

Related Questions