We are using VB6 and Word.Basic object to create documents. Text is inserted at a variety of bookmarks. Our latest requirement wants us to increase the font size for a given insert. We are currently doing this by setting the font size to 12 rather than the 8 that is normally there, however from a maintenance standpoint, I would rather be able to set this to say (currentfontsize + 4)… but so far I have not been able to find any method to get the current font size.
Does anyone have a way to do this?
Setting the font size of a bookmark is straight-forward in VBA:
Probably a better option if you want to increase the font size proportionally, is to use
Font.Growwhich will increase the font size to the next available size, e.g. to get from 8 to 12 you would have to call it 4 times.If you are not familiar with Word’s object model, a trick is to use the Macro Recorder. In you case, start the recorder, open the bookmarks dialog, go to the bookmark and then change the font size. The recorded actions will be saved as a module in your Normal.dot file by default. The action of changing the font size of a bookmark would result in the following recorded macro:
This code can be the basis for your own function (although it looks a bit different from the above sample, the effect will be the same).