By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,141 Members | 720 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,141 IT Pros & Developers. It's quick & easy.

VB Form in MS Word and Italics / Hyperlink

P: 1
Hi all,

I'm sure this is a really basic question, but here goes anyway!

I have a userForm with some text boxes / check boxes etc and when a user clicks the check box i would like some text to appear in MS Word via a bookmark. This is all working fine, but i would like part of the text paragraph to be in Italics and another part to be a hyperlink.

For example, if i had the following sentence, i would like the word 'fox' to be italicised and the word http://www.lazydog.com to be a hyperlink:

The quick brown fox jumps over the http://www.lazydog.com

How do i make the word 'fox' italics and the other a hyperlink? In html, to make something italics you just surround the word with <I> Fox </I> or whatever, is there something similar in VB?

No doubt its dead easy, but its driving me bonkers :)

Thanks!
Jun 2 '10 #1

✓ answered by QVeen72

Hi,

You want certain part of text in Word Doc to be Italisiced..?

This, I have got from Macro Recording..:

Expand|Select|Wrap|Line Numbers
  1. Selection.TypeText Text:="the quick "
  2. Selection.Font.Italic = wdToggle
  3. Selection.TypeText Text:="brown"
  4. Selection.Font.Italic = wdToggle
  5. Selection.TypeText Text:=" fox "
  6. ActiveDocument.Hyperlinks.Add Anchor:= _
  7. Selection.Range, Address:= _
  8. "http://www.temp.com", SubAddress:="", _
  9. ScreenTip:="", TextToDisplay:="temp"
  10. Selection.TypeText Text:=" Continue text..."
  11.  
Regards
Veena

Share this Question
Share on Google+
1 Reply

QVeen72
Expert 100+
P: 1,445
Hi,

You want certain part of text in Word Doc to be Italisiced..?

This, I have got from Macro Recording..:

Expand|Select|Wrap|Line Numbers
  1. Selection.TypeText Text:="the quick "
  2. Selection.Font.Italic = wdToggle
  3. Selection.TypeText Text:="brown"
  4. Selection.Font.Italic = wdToggle
  5. Selection.TypeText Text:=" fox "
  6. ActiveDocument.Hyperlinks.Add Anchor:= _
  7. Selection.Range, Address:= _
  8. "http://www.temp.com", SubAddress:="", _
  9. ScreenTip:="", TextToDisplay:="temp"
  10. Selection.TypeText Text:=" Continue text..."
  11.  
Regards
Veena
Jun 2 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.