Word Document Save as

57 Views Asked by At

I dabble in VBA so not the best. I have a code that sets a unique number to a quote on a word document for reference.

I now want to open the save as box. this will then set the file name to the unique number within the document and the file extension to .Pdf

I have it working to the save as...

it opens the dialogue box and sets the format to .Pdf but I cant figure out the rest? can someone help?

Sub AutoNew()
'
' AutoNew Macro
'
'
Order = System.PrivateProfileString("C:\Users\gary\Dropbox\Quotes & Prices\Quote Templates\Spec Templates\Current Intruder SDPs\Qnumber.txt", _
     "MacroSettings", "Order")

If Order = "" Then
 Order = 1
Else
 Order = Order + 1
End If

System.PrivateProfileString("C:\Users\gary\Dropbox\Quotes & Prices\Quote Templates\Spec Templates\Current Intruder SDPs\Qnumber.txt", "MacroSettings", _
     "Order") = Order

'Line bellow dictates what Client is and where to get the name from.


ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "000000#")

' Ignore the line bellow the save as
'ActiveDocument.SaveAs FileName:=("RPP Quote-") & Format(Order, "000000#")


'This section is the Save as Code

Application.FileDialog(msoFileDialogSaveAs).InitialFileName = FileName
Dim choice As Integer
choice = Application.FileDialog(msoFileDialogSaveAs).Show
If choice <> 0 Then
    FileName = Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)
    Call ActiveDocument.SaveAs("C:/Users/Gary/Desktop/"".Pdf")
    

End If

End Sub


0

There are 0 best solutions below