C# - insert macro into word document using C#
I am trying to insert a macro into eight Word documents using a C# program. I can open a word document and insert various things (particularly mailmerge, as that seem to be pretty prevalent on the net), but I cannot find any clues, that I understand, to point me in the right direction. I have the required macro in a .bas file and it just need slotting into my eight documents so that if I need to modify it I only have to do it once. Can anyone help please.
Michael GriffithPosted Jul 31, 2011, 10:27 AM
Thank you so much for your pointers. It looks very much just what I need. Unfortunatley I have to go out, but will eagerly return to plough through those articles.
I am very much a retired amateur so it may take me some time, but it looks hopeful. I shall let you know how I get on.
Once again, thanks for your reply.
kind regards
Michael
VulpesPosted Jul 31, 2011, 7:26 AM
Michael GriffithPosted Jul 31, 2011, 2:32 AM
Kind regards
Michael
Jiteendra SampathiraoPosted Jul 31, 2011, 1:48 AM
Hi,
I don't think you can "import" a macro from another document into a separate document on the fly.
I could be off based here but don't you want to create a Word Template with the macro in this template and then when you create a new Word Doc (through your C# code) based on this new template.
Source: code project
Refer this link