File Save with Predefined Name and Value from TextBox
I'm trying to allow the user to save their document, which is produced via a UserForm and utilising content controls, using the file name as "NFA Letter - " and string this together with the entry from the TextBox called txtRMSNum.
The error checking for ensuring that txtRMSNum has already been catered for, so this literally only needs to provide the concatenated file name prepopulated ready for the user to just select the save location.
Here is what I have so far, which is not producing the desired result.
Code:
Option Explicit
Sub ShowSaveAsDialog()
Dim oDialog As Dialog
Dim occ As ContentControl
Dim oRng As Range
Set oRng = occ.Range.Text
.txtRMSNum.Text = occ.Range.Text
Set oDialog = Application.Dialogs(wdDialogFileSaveAs)
With oDialog
.Name = "NFA Letter - " & oRng.txtRMSNum.Text
.Format = wdFormatXMLDocument
.Show
End With
lbl_Exit:
Exit Sub
End Sub