S
spanker
hi all relatively new to all this so hope i can get some help or pionters
i have a word template that i use,i merge the data from an excel sheet.
what i woulkd like to do is
when i merge a new document from a record in the excel sheet.
in the save dialog box i need it to put in the data from one of the merged
fields
(ie james smith) with a unique ref number and save to a spacific folder
ive found some vba code that will give me a unique ref number everytime the
template is used which works great.
i just dont know how to get the merged data to go in the save dialog box
this is the code i use for the unique ref number (thanks to Doug robbins)
Sub AutoNew()
Order = System.PrivateProfileString("C:\Settings.Txt", _
"MacroSettings", "Order")
If Order = "" Then
Order = 1
Else
Order = Order + 1
End If
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"Order") = Order
ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "00#")
ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#")
End Sub
thanks
Kevin
i have a word template that i use,i merge the data from an excel sheet.
what i woulkd like to do is
when i merge a new document from a record in the excel sheet.
in the save dialog box i need it to put in the data from one of the merged
fields
(ie james smith) with a unique ref number and save to a spacific folder
ive found some vba code that will give me a unique ref number everytime the
template is used which works great.
i just dont know how to get the merged data to go in the save dialog box
this is the code i use for the unique ref number (thanks to Doug robbins)
Sub AutoNew()
Order = System.PrivateProfileString("C:\Settings.Txt", _
"MacroSettings", "Order")
If Order = "" Then
Order = 1
Else
Order = Order + 1
End If
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"Order") = Order
ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "00#")
ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#")
End Sub
thanks
Kevin