Change font style of part of my macro

Sethomas5

Board Regular
Joined
Oct 5, 2015
Messages
204
Hello and thank you in advance!! This forum has been so helpful to me these past few weeks. I'm learning a lot too.
I'm running Excel 2013 on Windows 7.

This is the piece of code I am working with:
Code:
.Bookmarks("Oral_Class1").Range.Text = ws.Range("I2").Value & "/" & [COLOR="#FF0000"]ws.Range("G2").Value[/COLOR]

I would like to have the piece in RED be italicized in my word document.

Please let me know if you need clarification.
 
It looks like the Word object model has Range as a member of the Bookmark class, so try this for each of your bookmark references:

Code:
.Bookmarks("Writing_Class1").Range.Font.Italic=true

Would that make both Range ("I2") and Range ("G2") italic in my word document?
I need only the second range ("G2") to be italic...
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
The ranges I2 and G2 don't exist in your Word document. Only the Bookmark does. Therefore, you are italicizing the bookmark. The format of the Excel ranges is not relevant.
 
Upvote 0
The ranges I2 and G2 don't exist in your Word document. Only the Bookmark does. Therefore, you are italicizing the bookmark. The format of the Excel ranges is not relevant.

That makes sense. I guess I am trying to do something that cannot be done. I wanted the value retrieved from I2 to keep regular font and the value from G2 to be italicized when put in the word document...
OH WELL.

Thank you for your help.
 
Upvote 0

Forum statistics

Threads
1,226,112
Messages
6,189,041
Members
453,521
Latest member
Chris_Hed

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top