From: Dave on 6 Nov 2009 09:32 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 MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> EKH wrote: Previous Posts In This Thread: On woensdag 4 februari 2009 13:06 EK wrote: Envelope Macro and Adding Graphic to Return Address 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 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 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 My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> 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! "Graham Mayor" wrote: 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 My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> 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/tutorials/aspnet/cdc3dff8-eea5-47ac-91ea-fe2af1b58995/eggheadcafecom-msinfo-c.aspx
From: Doug Robbins - Word MVP on 7 Nov 2009 01:21 Dave Yousefi wrote: > 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.
|
Pages: 1 Prev: Word Count between Bookmarks Next: Paste with formatting |