Hi folks...pulling my hair out for hours on this seemingly simple task... trying to save a template as a docx file to a specific location and file name based on some text fields in the document.
In a MS Word template file, I have a text box control labeled LName. There's also a button named SaveTo with a Click script. Every time I try to get the text value from Lname using Lname.text I get:
"run-time error 424 Object required."
Here is my code: (under Template Project - Microsoft Word Object - ThisDocument)
Private Sub SaveTo_Click()
ActiveDocument.SaveAs FileName:="c:\scripts\invoice\file created" & " " & Format(Date, "mm-dd-yy")
' use msgbox to debug this thing
MsgBox (Lname.Text)
End Sub
In a MS Word template file, I have a text box control labeled LName. There's also a button named SaveTo with a Click script. Every time I try to get the text value from Lname using Lname.text I get:
"run-time error 424 Object required."
Here is my code: (under Template Project - Microsoft Word Object - ThisDocument)
Private Sub SaveTo_Click()
ActiveDocument.SaveAs FileName:="c:\scripts\invoice\file created" & " " & Format(Date, "mm-dd-yy")
' use msgbox to debug this thing
MsgBox (Lname.Text)
End Sub