WorkingVBA
Registered User.
- Local time
- Today, 02:34
- Joined
- Jul 3, 2013
- Messages
- 33
Hi,
I am in the process of building a MS Access application that constructs a word document based on predetermined choices. It has been a while so I feel like I am stumbling a bit in the dark. Depending on particular user choices the application builds a document consisting of predetermined paragraphs of text. Right now I am using the Word.application object and the corresponding commands .typetext and .typeparagraph. The problem is that I have no idea how to change the formatting of a word or a few words within the string other than breaking the paragraph up into smaller segments.
For example in order to do something like this:
(Embedding HTML tags does not work) I have to do:
You can see where this would be a problem when having a lot of formatting changes. Also, I am grateful for suggestions that make this easier since I am :banghead: after all. I briefly looked into using the StringBuilder command but could not find any suggestions for embedding formatting tags. Thanks in advance for your help. It feels good to be doing a little coding again, even if it is late at night after work (I think I may need a different hobby)
I am in the process of building a MS Access application that constructs a word document based on predetermined choices. It has been a while so I feel like I am stumbling a bit in the dark. Depending on particular user choices the application builds a document consisting of predetermined paragraphs of text. Right now I am using the Word.application object and the corresponding commands .typetext and .typeparagraph. The problem is that I have no idea how to change the formatting of a word or a few words within the string other than breaking the paragraph up into smaller segments.
For example in order to do something like this:
Code:
With apWord.Selection
.TypeText "Lorem Ipsum is simply <b>dummy text</b> of the printing and typesetting industry."
.TypeParagraph
End With
(Embedding HTML tags does not work) I have to do:
Code:
With apWord.Selection
.TypeText "Lorem Ipsum is simply"
.Font.Bold = True
.TypeText " dummy text"
.Font.Bold = False
.TypeText " of the printing and typesetting industry."
.TypeParagraph
End With
You can see where this would be a problem when having a lot of formatting changes. Also, I am grateful for suggestions that make this easier since I am :banghead: after all. I briefly looked into using the StringBuilder command but could not find any suggestions for embedding formatting tags. Thanks in advance for your help. It feels good to be doing a little coding again, even if it is late at night after work (I think I may need a different hobby)