Click here to Skip to main content
15,886,632 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
I asked this question in another community, but not answered.
I wonder if it is possible to insert VBA macros into Word 2010 with C# (with an exe)?

I want to deploy a word2010 macro to our co-workers in my office. This my 2rd-3th question around this problem. Add-in or module method has failed. Very difficult to them. I need one-click exe to set a bunch of macros in to normal.dot.

Thank you
Posted
Comments
Maciej Los 3-Dec-13 8:03am    
Replace normal.dot instead creating exe to change normal.dot ;)
Why addin has failed?
phil.o 3-Dec-13 8:50am    
If you are using the Word file-format introduced in 2007 version, you may have to modify the normal.dotm file instead of the normal.dot.

Please, read my comment first.

There are several resons why not to insert macros in normal template. The most important is security. Please, see this: Working with Microsoft Word Templates—The Foundation[^]

As i mentioned, the simplest method is to replace normal.dot (using for example zip self-extractor or any other application).

If you need to do something special, i would suggest you to create Word - VBA addin[^].
Creating VBA Add-ins to Extend and Automate Microsoft Office Documents[^]

If you prefer to write COM addin, please see:
Walkthrough: Creating Your First Application-Level Add-in for Word[^]
Writing a Word Add-in - Part I[^]
 
Share this answer
 
v2
Comments
caglarorX2 3-Dec-13 10:34am    
I haven't enough time just now. But it seems you totally explain everything i need. Thank you very much.
Maciej Los 3-Dec-13 10:40am    
You're welcome ;)
Please, mark this answer as a solution (green button).
Hi,

Yes you can try this : Link[^]
 
Share this answer
 
Comments
caglarorX2 3-Dec-13 8:08am    
Thank you. My office members has no computer experience. They use computer (and word 2010) as a typewriter. So i need to offer very simple (one-click) solution to them. Add-in and modules are complicated for office members (really). And they have different normal.dot templates. They write formal letters etc. And their departments are different from each other. So i came to that point one-click exe :(
caglarorX2 3-Dec-13 8:11am    
Macros are very simple as converting (saveas) Active documents to pdf file and like these jobs.
caglarorX2 3-Dec-13 8:19am    
@Suvabrata Roy , need to write-save into words VBA as macro of normal.dot The link explains how to running a macro.
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900