Greetings!
I am very new to VBA. Please be forgive me if I don't follow the programming rules. It is not because I am rude, it is because I don't know.
I have a Word Document template that data is entered in the UserForm TextBoxe1.
I want a code that saves the Document as the value entered in the TextBox1.
Here is my main program with other irrelevant codes that I left out...
Private Sub CommandButton1_Click()
Dim LFname As Range ' LFname is a bookmark in the document
Set LFname = ActiveDocument.Bookmarks("LFname").Range
LFname.Text = Me.TextBox1.Value ' TextBox1 is the TextBox in the UserForm where Last name and First name is entered .
And here is the save sub.
Private Sub CommandButton2_Click()
Set dlgSaveAs = Dialogs(wdDialogFileSaveAs)
With dlgSaveAs
.Name = "????????? " ' This is where I want the Last name and First name entered in the TextBox1 to appear
.Format = wdFormatXMLDocument
.Show
End With
Thanks in advance
End Sub
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.