Using VBA 2007, how can I create a Word document from Excel and write text of different headings (heading1, heading2, normal) so that the headings would appear in the document map?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This example will run from Excel. It uses Early Binding so you need to ensure you have a reference to Word set in the VBA References (Tools->References).
Word can be a fickle best with putting text in the document. Generally it needs to go a the currently selected point. You can use Bookmarks and/or field codes to put text in different locations within a document.