K
Keith
I am baffled as to how to create a envelope mailmerge document
automatically (without user interaction) using VBA. I have recorded how
word does it and the recorded macro apparently takes a "behind the
scenes" step in the creation of an autotext entry that it subsequently
uses when creating the mergedocument. Each time I record the process,
Word creates a new autotext entry and then uses that entry as the
parameter for the .Envelope.Insert AutoText:= command:
Activedocument.Envelope.Insert ExtractAddress:=False,
OmitReturnAddress:= _
False, PrintBarCode:=False, PrintFIMA:=False,
Height:=InchesToPoints(4.13 _
), Width:=InchesToPoints(9.5), Address:="", AutoText:=
"ToolsCreateEnvelope2"
In this example, an unrecorded command created the autotext entry
ToolsCreateEnvelope2. When I examine the autotext entry
ToolsCreateEnvelope2, I find that it contains the mergefields that I
added via the set up envelope command when I recorded the above command
in Word.
Because I am calling this VBA routine from Access and want the system
to automatically create the merge envelope document without user
intervention, I have to somehow figure out how to do this
automatically.
As I see it my options are:
- Somehow programmatically create an autotext entries containing my
mergefields.
or
- Somehow enter a string for the Autotext entry that includes the
mergefields I want to show in the address box
or
- Programmatically select the address text box and then insert
mergefield using the standard ActiveDocument.Mergefield.Add command.
I don't have any idea how to do any of these.
Any one have any experience with this problem?
automatically (without user interaction) using VBA. I have recorded how
word does it and the recorded macro apparently takes a "behind the
scenes" step in the creation of an autotext entry that it subsequently
uses when creating the mergedocument. Each time I record the process,
Word creates a new autotext entry and then uses that entry as the
parameter for the .Envelope.Insert AutoText:= command:
Activedocument.Envelope.Insert ExtractAddress:=False,
OmitReturnAddress:= _
False, PrintBarCode:=False, PrintFIMA:=False,
Height:=InchesToPoints(4.13 _
), Width:=InchesToPoints(9.5), Address:="", AutoText:=
"ToolsCreateEnvelope2"
In this example, an unrecorded command created the autotext entry
ToolsCreateEnvelope2. When I examine the autotext entry
ToolsCreateEnvelope2, I find that it contains the mergefields that I
added via the set up envelope command when I recorded the above command
in Word.
Because I am calling this VBA routine from Access and want the system
to automatically create the merge envelope document without user
intervention, I have to somehow figure out how to do this
automatically.
As I see it my options are:
- Somehow programmatically create an autotext entries containing my
mergefields.
or
- Somehow enter a string for the Autotext entry that includes the
mergefields I want to show in the address box
or
- Programmatically select the address text box and then insert
mergefield using the standard ActiveDocument.Mergefield.Add command.
I don't have any idea how to do any of these.
Any one have any experience with this problem?