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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 81k
  • Answers 81k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer POP before SMTP is not part of the SMTP standard,… May 11, 2026 at 4:31 pm
  • Editorial Team
    Editorial Team added an answer No, there is no official Exposé API. What effects are… May 11, 2026 at 4:31 pm
  • Editorial Team
    Editorial Team added an answer https://stackoverflow.com/questions/820493/can-an-seo-friendly-url-contain-a-unique-id I'd say you're fine. May 11, 2026 at 4:31 pm

Related Questions

I inherited a piece of code from a recently-retired colleague that gets the total
How can I emulate classes (and namespaces) in JavaScript? I need to create a
I am trying to perform tuning of materialized views in my application. I set
I've run into a snag with a ADO.NET Entity Framework model and a ADO.NET

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.