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 6083439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:24:13+00:00 2026-05-23T11:24:13+00:00

I am using Visual Studio 2010 with VSTO. Presently, I am working on modifying

  • 0

I am using Visual Studio 2010 with VSTO. Presently, I am working on modifying the contents of the body through a ribbon button, after the email has been typed.

I am aware the Word Editor is the default editor in Outook 2007. So how can I get the text of the body to perform search and replace operations when using word editor for the inspector window(compose mail window)?

I have a macro code in VBA, which works perfectly fine. I want to convert this code into C sharp which will work when the ribbon button is clicked in compose mail window.

Sub ASAtoHyperlinkCompose()

 Dim uiInspector As Outlook.Inspector

 Dim uiObject  As Object

 Dim uiItem   As Outlook.MailItem

 Dim uiDoc   As Word.Document

 Set uiInspector = Application.ActiveInspector

 Set uiObject = uiInspector.CurrentItem

 If uiObject.MessageClass = "IPM.Note" And _

  uiInspector.IsWordMail = True Then

  Set uiItem = uiInspector.CurrentItem

  Set uiDoc = uiInspector.WordEditor

  With uiDoc.Range.Find

   .Text = "ASA^$^$^#^#^#^#^#"

   While .Execute

   .Parent.Hyperlinks.Add .Parent, _

  "http://stack.com=" & .Parent.Text & "outlook2007"

    .Parent.Collapse wdCollapseEnd

   Wend

  End With

  End If

End Sub
  • 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. Editorial Team
    Editorial Team
    2026-05-23T11:24:13+00:00Added an answer on May 23, 2026 at 11:24 am

    I’m not familiar with Outlook’s automation and toolkit. This is more or less the same code converted to C#. If nothing else it is a start. There is no C# equivalent With statement FYI.

    private void ASAtoHyperlinkCompose()
       {                                           
           var uiInspector = Application.ActiveInspector;
    
           var uiObject = uiInspector.CurrentItem;
    
           if (uiObject.MessageClass.ToString().Equals("IPM.Note") && uiInspector.IsWordMail)
           {
               var uiItem = uiInspector.CurrentItem;
    
               var uiDoc = uiInspector.WordEditor;
    
               uiDoc.Range.Find.Text = "ASA^$^$^#^#^#^#^#";
    
               while (uiDoc.Range.Find.Execute())
               {
                   uiDoc.Range.Find.Parent.Hyperlinks.Add(uiDoc.Range.Find.Parent, string.Format(@"http://stack.com={0}outlook2007", uiDoc.Range.Find.Parent.Text));
                   uiDoc.Range.Find.Parent.Collapse(wdCollapseEnd);
    
               }
           }
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Visual Studio 2010 I believe it's working correctly, as in after any document
I am working on a VSTO project using excel 2010 and visual studio 2010.
I'm using Visual Studio 2010 RC. Would it be possible that after doing my
I am using the Visual Studio 2010 RC. Sometimes when I am working on
I am using Visual Studio 2010 targeting .Net 4.0 I am working with an
I'm using Visual Studio 2010 on Windows 7 32bit, and I'm working on my
I am using Visual Studio 2010 (c++), and Intellisense has stopped working. I've read
I'm using Visual Studio 2010 Ultimate and I after searching for XNA Download on
i am using visual studio 2010 and Windows XP on a macbook through bootcamp.
I have developed a Outlook Addin using VSTO in Visual Studio 2010, on Windows

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.