Envelope Macro and Adding Graphic to Return Address

E

EKH

Hi

I'm trying to create a Word 2007 macro that will insert an envelope into a
document with a specific return address and logo. I've saved the return
address and logo as autotext entries named "CompanyLogowithGraphic1" and
"CompanyLogowithGraphic2". And have referenced these with the Return
Autotext Parameter. This doesn't work. I haven't been able to find any
information on using this, am I way off base here? Is there any way to do
what I'm trying to accomplish? Following is the Envelope.Insert portion of
the code:

Private Sub CmdAddEnvelope_Click()

If OptAddEnvelope1.Value = True Then
ActiveDocument.Envelope.Insert ExtractAddress:=False, _
Address:="Recipient Address", OmitReturnAddress:=False, ReturnAddress:="",
ReturnAutoText:="CompanyLogowithGraphic1", PrintBarCode:=False, _
PrintFima:=False, Size:="custom size", Height:=InchesToPoints(4), _
Width:=InchesToPoints(7)

frmEnvelopeType.Hide
End If

If OptAddEnvelope2.Value = True Then
ActiveDocument.Envelope.Insert ExtractAddress:=False, _
Address:="Recipient Address", OmitReturnAddress:=False, ReturnAddress:="",
ReturnAutoText:="CompanyLogowithGraphic2", PrintBarCode:=False, _
PrintFima:=False, Size:="custom size", Height:=InchesToPoints(4), _
Width:=InchesToPoints(7)

frmEnvelopeType.Hide
End If
End Sub
 
G

Graham Mayor

Assuming the autotext entries are stored in the document template, how about

Private Sub CmdAddEnvelope_Click()
If OptAddEnvelope1.Value = True Then
With ActiveDocument
.Envelope.Insert _
ExtractAddress:=False, _
Address:="Recipient Address", OmitReturnAddress:=True, _
Size:="custom size", Height:=InchesToPoints(4), _
Width:=InchesToPoints(7)
.AttachedTemplate.AutoTextEntries("CompanyLogowithGraphic1").Insert _
Where:=Selection.Range, _
RichText:=True
End With
frmEnvelopeType.Hide
End If

If OptAddEnvelope2.Value = True Then
With ActiveDocument
.Envelope.Insert _
ExtractAddress:=False, _
Address:="Recipient Address", OmitReturnAddress:=True, _
Size:="custom size", Height:=InchesToPoints(4), _
Width:=InchesToPoints(7)
.AttachedTemplate.AutoTextEntries("CompanyLogowithGraphic2").Insert _
Where:=Selection.Range, _
RichText:=True
End With
frmEnvelopeType.Hide
End If
End Sub

If you are interested, I have a personal version of the add-in at
http://www.gmayor.com/Numbered_labels.htm which adds buttons to the mailings
tab to create alternative envelopes using data that is taken from the
letterhead, from Outlook or typed from the keyboard. It would be simple
enough to modify it to use your envelopes (if you e-mail them to me via the
link on my web site). However it does not add the envelopes to the letters,
but treats them as separate documents.

The principle involved is essentially that at -
http://www.gmayor.com/Alternative_Return_Addresses.htm
with a variation on the macro at
http://www.gmayor.com/mailmerge_from_outlook.htm


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

The numbered label add-in on my web site is not the personal version I
referred to in my reply. If you want a version of that one, you will need to
send me copies of your envelope documents.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
D

Dave Yousefi

Hallo,

I want to run a Word Macro from an Addin created in VS 2008.Lets say I create a new projects -->Office --> Word 2003 Addin and in ThisAddIn_Startup start up methode want to run a Macro code e.g.

Public Module Module1
Sub
msgbox("Test Macro")
EndSub
End Module
Althogh I know tha I can add Macro modules from menu Tools --> Macros but how do I run the code from the addin at startup when I start Word from Debug menuk !?

Thanks,

p.s. I create C# projects.



Graham Mayor wrote:

The numbered label add-in on my web site is not the personal version I
07-feb-09

The numbered label add-in on my web site is not the personal version I
referred to in my reply. If you want a version of that one, you will need to
send me copies of your envelope documents

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<
Graham Mayor - Word MV

My web site www.gmayor.co
Word MVP web site http://word.mvps.or
<>>< ><<> ><<> <>>< ><<> <>>< <>><<

EKH wrote:

Previous Posts In This Thread:

On woensdag 4 februari 2009 13:06
EK wrote:

Envelope Macro and Adding Graphic to Return Address
H

I'm trying to create a Word 2007 macro that will insert an envelope into a
document with a specific return address and logo. I've saved the return
address and logo as autotext entries named "CompanyLogowithGraphic1" and
"CompanyLogowithGraphic2". And have referenced these with the Return
Autotext Parameter. This doesn't work. I haven't been able to find any
information on using this, am I way off base here? Is there any way to do
what I'm trying to accomplish? Following is the Envelope.Insert portion of
the code

Private Sub CmdAddEnvelope_Click(

If OptAddEnvelope1.Value = True The
ActiveDocument.Envelope.Insert ExtractAddress:=False, _
Address:="Recipient Address", OmitReturnAddress:=False, ReturnAddress:="",
ReturnAutoText:="CompanyLogowithGraphic1", PrintBarCode:=False, _
PrintFima:=False, Size:="custom size", Height:=InchesToPoints(4), _
Width:=InchesToPoints(7

frmEnvelopeType.Hid
End I

If OptAddEnvelope2.Value = True The
ActiveDocument.Envelope.Insert ExtractAddress:=False, _
Address:="Recipient Address", OmitReturnAddress:=False, ReturnAddress:="",
ReturnAutoText:="CompanyLogowithGraphic2", PrintBarCode:=False, _
PrintFima:=False, Size:="custom size", Height:=InchesToPoints(4), _
Width:=InchesToPoints(7

frmEnvelopeType.Hid
End I
End Sub

On donderdag 5 februari 2009 4:38
Graham Mayor wrote:

Assuming the autotext entries are stored in the document template, how
Assuming the autotext entries are stored in the document template, how abou

Private Sub CmdAddEnvelope_Click(
If OptAddEnvelope1.Value = True The
With ActiveDocumen
.Envelope.Insert
ExtractAddress:=False,
Address:="Recipient Address", OmitReturnAddress:=True,
Size:="custom size", Height:=InchesToPoints(4),
Width:=InchesToPoints(7
.AttachedTemplate.AutoTextEntries("CompanyLogowithGraphic1").Insert
Where:=Selection.Range,
RichText:=Tru
End Wit
frmEnvelopeType.Hid
End I

If OptAddEnvelope2.Value = True The
With ActiveDocumen
.Envelope.Insert
ExtractAddress:=False,
Address:="Recipient Address", OmitReturnAddress:=True,
Size:="custom size", Height:=InchesToPoints(4),
Width:=InchesToPoints(7
.AttachedTemplate.AutoTextEntries("CompanyLogowithGraphic2").Insert
Where:=Selection.Range,
RichText:=Tru
End Wit
frmEnvelopeType.Hid
End I
End Su

If you are interested, I have a personal version of the add-in at
http://www.gmayor.com/Numbered_labels.htm which adds buttons to the mailings
tab to create alternative envelopes using data that is taken from the
letterhead, from Outlook or typed from the keyboard. It would be simple
enough to modify it to use your envelopes (if you e-mail them to me via the
link on my web site). However it does not add the envelopes to the letters,
but treats them as separate documents

The principle involved is essentially that at -
http://www.gmayor.com/Alternative_Return_Addresses.ht
with a variation on the macro at
http://www.gmayor.com/mailmerge_from_outlook.htm


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


EKH wrote:

On vrijdag 6 februari 2009 23:37
EK wrote:

THANKS!!!
THANKS!!! That works great. I will take a look at the Numbered Labels Add-in
too!

:

On zaterdag 7 februari 2009 2:31
Graham Mayor wrote:

The numbered label add-in on my web site is not the personal version I
The numbered label add-in on my web site is not the personal version I
referred to in my reply. If you want a version of that one, you will need to
send me copies of your envelope documents.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


EKH wrote:

EggHeadCafe - Software Developer Portal of Choice
Build a Custom .NET "EVAL" Provider
http://www.eggheadcafe.com/tutorial...111-86931c86eb9d/build-a-custom-net-eval.aspx
 
D

Dave Yousefi

Hallo,

I want to run a Word Macro from an Addin created in VS 2008.Lets say I create a new projects -->Office --> Word 2003 Addin and in ThisAddIn_Startup start up methode want to run a Macro code e.g.

Public Module Module1
Sub
msgbox("Test Macro")
EndSub
End Module
Althogh I know tha I can add Macro modules from menu Tools --> Macros but how do I run the code from the addin at startup when I start Word from Debug menuk !?

Thanks,

p.s. I create C# projects.



Graham Mayor wrote:

The numbered label add-in on my web site is not the personal version I
07-feb-09

The numbered label add-in on my web site is not the personal version I
referred to in my reply. If you want a version of that one, you will need to
send me copies of your envelope documents

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<
Graham Mayor - Word MV

My web site www.gmayor.co
Word MVP web site http://word.mvps.or
<>>< ><<> ><<> <>>< ><<> <>>< <>><<

EKH wrote:

Previous Posts In This Thread:

On woensdag 4 februari 2009 13:06
EK wrote:

Envelope Macro and Adding Graphic to Return Address
H

I'm trying to create a Word 2007 macro that will insert an envelope into a
document with a specific return address and logo. I've saved the return
address and logo as autotext entries named "CompanyLogowithGraphic1" and
"CompanyLogowithGraphic2". And have referenced these with the Return
Autotext Parameter. This doesn't work. I haven't been able to find any
information on using this, am I way off base here? Is there any way to do
what I'm trying to accomplish? Following is the Envelope.Insert portion of
the code

Private Sub CmdAddEnvelope_Click(

If OptAddEnvelope1.Value = True The
ActiveDocument.Envelope.Insert ExtractAddress:=False, _
Address:="Recipient Address", OmitReturnAddress:=False, ReturnAddress:="",
ReturnAutoText:="CompanyLogowithGraphic1", PrintBarCode:=False, _
PrintFima:=False, Size:="custom size", Height:=InchesToPoints(4), _
Width:=InchesToPoints(7

frmEnvelopeType.Hid
End I

If OptAddEnvelope2.Value = True The
ActiveDocument.Envelope.Insert ExtractAddress:=False, _
Address:="Recipient Address", OmitReturnAddress:=False, ReturnAddress:="",
ReturnAutoText:="CompanyLogowithGraphic2", PrintBarCode:=False, _
PrintFima:=False, Size:="custom size", Height:=InchesToPoints(4), _
Width:=InchesToPoints(7

frmEnvelopeType.Hid
End I
End Sub

On donderdag 5 februari 2009 4:38
Graham Mayor wrote:

Assuming the autotext entries are stored in the document template, how
Assuming the autotext entries are stored in the document template, how abou

Private Sub CmdAddEnvelope_Click(
If OptAddEnvelope1.Value = True The
With ActiveDocumen
.Envelope.Insert
ExtractAddress:=False,
Address:="Recipient Address", OmitReturnAddress:=True,
Size:="custom size", Height:=InchesToPoints(4),
Width:=InchesToPoints(7
.AttachedTemplate.AutoTextEntries("CompanyLogowithGraphic1").Insert
Where:=Selection.Range,
RichText:=Tru
End Wit
frmEnvelopeType.Hid
End I

If OptAddEnvelope2.Value = True The
With ActiveDocumen
.Envelope.Insert
ExtractAddress:=False,
Address:="Recipient Address", OmitReturnAddress:=True,
Size:="custom size", Height:=InchesToPoints(4),
Width:=InchesToPoints(7
.AttachedTemplate.AutoTextEntries("CompanyLogowithGraphic2").Insert
Where:=Selection.Range,
RichText:=Tru
End Wit
frmEnvelopeType.Hid
End I
End Su

If you are interested, I have a personal version of the add-in at
http://www.gmayor.com/Numbered_labels.htm which adds buttons to the mailings
tab to create alternative envelopes using data that is taken from the
letterhead, from Outlook or typed from the keyboard. It would be simple
enough to modify it to use your envelopes (if you e-mail them to me via the
link on my web site). However it does not add the envelopes to the letters,
but treats them as separate documents

The principle involved is essentially that at -
http://www.gmayor.com/Alternative_Return_Addresses.ht
with a variation on the macro at
http://www.gmayor.com/mailmerge_from_outlook.htm


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


EKH wrote:

On vrijdag 6 februari 2009 23:37
EK wrote:

THANKS!!!
THANKS!!! That works great. I will take a look at the Numbered Labels Add-in
too!

:

On zaterdag 7 februari 2009 2:31
Graham Mayor wrote:

The numbered label add-in on my web site is not the personal version I
The numbered label add-in on my web site is not the personal version I
referred to in my reply. If you want a version of that one, you will need to
send me copies of your envelope documents.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


EKH wrote:

On vrijdag 6 november 2009 9:31
Dave Yousefi wrote:

Run Word Macro from Addin
Hallo,

I want to run a Word Macro from an Addin created in VS 2008.Lets say I create a new projects -->Office --> Word 2003 Addin and in ThisAddIn_Startup start up methode want to run a Macro code e.g.

Public Module Module1
Sub
msgbox("Test Macro")
EndSub
End Module
Althogh I know tha I can add Macro modules from menu Tools --> Macros but how do I run the code from the addin at startup when I start Word from Debug menuk !?

Thanks,

p.s. I create C# projects.

EggHeadCafe - Software Developer Portal of Choice
EggheadCafe.com MSInfo C# Webservice
http://www.eggheadcafe.com/tutorial...1ea-fe2af1b58995/eggheadcafecom-msinfo-c.aspx
 
D

Doug Robbins - Word MVP

Dave said:
Hallo,

I want to run a Word Macro from an Addin created in VS 2008.Lets say I create a new projects -->Office --> Word 2003 Addin and in ThisAddIn_Startup start up methode want to run a Macro code e.g.

Public Module Module1
Sub
msgbox("Test Macro")
EndSub
End Module
Althogh I know tha I can add Macro modules from menu Tools --> Macros but how do I run the code from the addin at startup when I start Word from Debug menuk !?

Thanks,

p.s. I create C# projects.



Graham Mayor wrote:

The numbered label add-in on my web site is not the personal version I
07-feb-09

The numbered label add-in on my web site is not the personal version I
referred to in my reply. If you want a version of that one, you will need to
send me copies of your envelope documents.
Put the code in a sub-routine named autoexec.

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my
services on a paid professional basis.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top