Question Locked

Can a MS Word template be converted to VB

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Templates (macros programmed in VBA) can be used to automate MS Word documents with forms and combo-boxes, etc. Can the VBA code in such a template be transferred to a Visual Basic executable file and still perform the same functions as the template with Word.

John James

5 replies

by slayer_

It can't be directly transferred because of the different libraries.

You can create a word application object and manipulate it, but you cannot easily have the word documents combo box call back to the VB's code.

by iphelion

If you are using the DOCX format then you can use the Microsoft OpenXML API to generate word documents. There is also a nifty tool in the toolkit to allow you to open a word document and it will generate a C# source code class for you that will reproduce that document using the API calls, you can then go in and manipulate whatever you like inside the content.

Some useful links:-

DOWNLOAD THE API AND TOOLKIT HERE
http://www.microsoft.com/downloads/details.aspx?FamilyId=C6E744E5-36E9-45F5-8D8C-331DF206E0D0

OFFICE DEVELOPER CENTRE
http://msdn.microsoft.com/en-us/office/default.aspx

Hope this is helpful,
ANdy

http://www.iphelion.com

This discussion is closed to new replies.