
This procedure inserts the text into the bookmark, not after it.

The Call FillBM passes the bookmark name, and text content to the Sub FillBM.

Will display the combox with Rockwool displayed.Ĭall FillBM("Insulation1", "put the Rockwool TXT")Ĭall FillBM("Insulation1", "put the Rockwool DK TXT")Ĭall FillBM("Insulation1", "put Armaflex DK TXT")Ĭall FillBM("Insulation1", "put Armaflex HT TXT") It is normally a good thing to have a combobox have an item displayed, rather than blank. Why do you have both the combobox to select an item, and a checkbox?Ħ. Why do you have a MultiPage with only one tab ("General")? Are you going to end with more tabs?ĥ. Put the Rockwool TXT (after the bookmark Insulation1)ĭo you want to replace "put the Rockwool TXT" with "put PIR TXT"?Ĥ. However, using the above code, you will notice that "put PIR TXT" is placed after the bookmark. You fixed that with the later version of (for example):ĪctiveDocument.Bookmarks("Insulation1").Range.Text = "put PIR TXT"ģ. VBA is expecting a string (or a string variable), but the code is not a string. The reason you had the ealier error was indeed the line:ĪctiveDocument.Bookmarks("Insulation1").Range.Text = Insulation In the VBE, go Tools > Options and under the Editor tab, check "Require Variable Declaration".Ģ. I strongly suggest you use Option Explicit in your code modules. It is not possible to have a Word document with zero paragraphs. Should not be needed, as ALL Word documents have a paragraph to start with.

'Insert a paragraph at the beginning of the document. ODoc.Paragraphs(1).Range.Style = "Whatever" If all of those characteristics are in the Style (say named "Whatever"), then you could: Use Styles rather than manually setting properties like Font.Size, or Bold.whatever. ParagraphFormat.Alignment = wdAlignParagraphJustifyĢ.

If you are actually in Word, there is never a need to make an instance of Word. Means you are executing the VBA from some other application (Excel, PowerPoint, Access.). Set oWord = CreateObject("Word.Application") Surely (I hope) it does not mean you are executing the code from Word.
