none
Insert and activate a phone number in a generated word document RRS feed

  • Question

  • Hey guys,

    I would like to add a phone number to a word document that I generate using the mso api.

    In word, when one writes (Tel:00493298402938) and new line, the phone number is activated automatically.

    While trying to record the corresponding macro and check the VBA code, it doesn't show the same behavior and the phone number is interpreted as a normal text.

    Any helpful source code in VBA, C# or C++ is welcome.

    Thanks!
    Thursday, March 12, 2015 3:45 PM

Answers

  • Hi Cindy,

    It worked. I added a lync addin in word. and used:

        HyperlinkPtr Add (
            IDispatch * Anchor,
            VARIANT * Address = &vtMissing,
            VARIANT * SubAddress = &vtMissing,
            VARIANT * ScreenTip = &vtMissing,
            VARIANT * TextToDisplay = &vtMissing,
            VARIANT * Target = &vtMissing );
    with the second parameter "tel:002123049034" instead of just the phone number.

    Monday, March 16, 2015 1:51 PM

All replies

  • Hi Zakaria

    Could you please be more specific about what you mean by "the phone number is activated automatically", please? And which version of Word is this?

    If I type a phone number into a Word document, nothing special happens, nor am I aware of any option that would have that kind of effect. Is it possible you have a macro, add-in or other third-party software that's doing whatever it is you're seeing?


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, March 12, 2015 7:06 PM
    Moderator
  • Hi Cindy,

    Thanks for your answer. It is the so called smart tags. I am investigating how can I add the associated action via VBA or C++.

    I am interested in making a phone call directly from word document.

    Friday, March 13, 2015 12:54 PM
  • Hi Zakaria

    Well, you can find information on the object model here: https://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.smarttags.add%28v=office.11%29.aspx?f=255&MSPPError=-2147217396

    However, it was deprecated starting in Office 2010 and has been removed from Office 2013 so I'm not sure you want to invest in this approach...


    Cindy Meister, VSTO/Word MVP, my blog

    Saturday, March 14, 2015 8:56 PM
    Moderator
  • Hi Cindy,

    It worked. I added a lync addin in word. and used:

        HyperlinkPtr Add (
            IDispatch * Anchor,
            VARIANT * Address = &vtMissing,
            VARIANT * SubAddress = &vtMissing,
            VARIANT * ScreenTip = &vtMissing,
            VARIANT * TextToDisplay = &vtMissing,
            VARIANT * Target = &vtMissing );
    with the second parameter "tel:002123049034" instead of just the phone number.

    Monday, March 16, 2015 1:51 PM