Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 98875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:16:47+00:00 2026-05-11T00:16:47+00:00

When I perform the following code: Dim italicSaveRange As Word.Range Dim savedItalic As Variant

  • 0

When I perform the following code:

Dim italicSaveRange As Word.Range Dim savedItalic As Variant Dim someRange As Word.Range  Set italicSaveRange = someRange.Duplicate italicSaveRange.Collapse (WdCollapseEnd) savedItalic = italicSaveRange.Italic someRange.Italic = True italicSaveRange.Italic = savedItalic 

I expected that any text entered at the cursor or inserted into someRange a la:

someRange.InsertAfter 'Lorem ipsum...' 

would not be italic (assuming that the formatting was not italic at this position previously, of course.) But it is. Help.


Based on your suggestion I now have the following, which appears to be working. It may be a fragile solution, depending on what gets moved around in the meantime (e.g., try typing some italic text into Word, ctrl-i to prepare to use non-italic, but then move the cursor left into the italics and then right out again; the cursor is inserting italic text…), but for my purposes where I am adding text elsewhere (but at a different level of the code so that I cannot access the text to insert at this level) this will probably work. Thank you.

Set italicSaveRange = someRange.Duplicate italicSaveRange.Collapse (WdCollapseEnd) savedItalic = italicSaveRange.Italic someRange.Italic = True italicSaveRange.InsertAfter SP italicSaveRange.Characters(1).Italic = savedItalic italicSaveRange.Characters(1).Delete 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T00:16:48+00:00Added an answer on May 11, 2026 at 12:16 am

    When you insert text into a Word Range object, this text will always (afaik) inherit the formatting of the previous text run.

    To work around you should apply the formatting after you inserted the text, i.e.

    Dim italicSaveRange As Word.Range Dim savedItalic As Variant Dim someRange As Word.Range  Set italicSaveRange = someRange.Duplicate italicSaveRange.Collapse (WdCollapseEnd) savedItalic = italicSaveRange.Italic someRange.Italic = True italicSaveRange.Text = 'Lorem ipsum...' italicSaveRange.Italic = savedItalic 

    If you must insert the text later you could need to insert some dummy text which you replace later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to perform a nested AJAX call using the following code. The
What I need - The code to perform the following: I am trying to
Details are in the comments. The following code: // Perform the fetch... NSError *error
I have written the following code to perform some simultaneous HTTP posting and file
today I was wondering if there is a better solution perform the following code
I've got following code to perform XSLT transformation from one JAXB annotated object to
I have the following code. I would like to perform a if then check
Anyone know how to perform following code using list comprehension? I'm stuck due to
The following code samples produce the same error when I perform the SAVEAS: Microsoft.Office.Interop.Excel.Application
I am using the following code to perform some manipulations on the image that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.