troubleshooting Question

How to Save as what entered in TextBox1

Avatar of Hamza Bazger
Hamza Bazger asked on
ProgrammingVBAMicrosoft Word
5 Comments1 Solution127 ViewsLast Modified:
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
ASKER CERTIFIED SOLUTION
NorieSenior Associate
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros