Consulting

Results 1 to 2 of 2

Thread: Edit URL in meeting hyperlink (MS Teams meeting)

  1. #1
    VBAX Newbie
    Joined
    Mar 2020
    Posts
    1
    Location

    Edit URL in meeting hyperlink (MS Teams meeting)

    Hello everyone,

    I have never written VBA in Outlook (only Excel), I have looked and could not find an answer to, what I believe may be a simple solution. I know enough I could have altered a similar code, but found nothing similar (for Outlook this would be easy in Excel).

    I need a macro that will replace any hyperlinks in meetings from "https://teams.Microsoft.com/BlaBlaBla" with "mteams://teams.microsoft.com/BlaBlaBla" (Change 'https' to 'msteams')

    Currently the URL in a Teams meeting opens a web site/app, I have to select "open in desktop app", and the internet tab doesn't close... Changing https to msteams opens the meeting directly in the desktop app.

    I don't want to manually edit every meeting I send. The fact the current link opens a web page that does not close after launching the desktop app, leaves me with a bunch of tabs open on a busy day

    Sorry I have no code of my own but this is a top complaint on MS support site - many could benefit from this...

  2. #2
    I cannot test this without the source material, but something along the lines of the following should help point the way.

    Sub Macro1()
    Dim olMeeting As Object
    Dim olInsp As Outlook.Inspector
    Dim wdDoc As Object
    Dim oLink As Object
    Dim strAddress As String
    
        On Error Resume Next
        Select Case Outlook.Application.ActiveWindow.Class
            Case olInspector
                Set olMeeting = ActiveInspector.currentItem
            Case olExplorer
                Set olMeeting = Application.ActiveExplorer.Selection.Item(1)
        End Select
    
        If TypeName(olMeeting) = " MeetingItem" Then
            With olMeeting
                Set olInsp = .GetInspector
                Set wdDoc = olInsp.WordEditor
                For Each oLink In wdDoc.Range.hyperlinks
                    strAddress = oLink.Address
                    If LCase(strAddress) = "https://teams.microsoft.com/blablabla" Then
                        strAddress = "mteams://teams.microsoft.com/BlaBlaBla"
                        'MsgBox strAddress
                        oLink.Address = strAddress
                        oLink.TextToDisplay = strAddress    'or whatever
                    End If
                Next oLink
                olMeeting.Save
            End With
        End If
    lbl_Exit:
        Set olMeeting = Nothing
        Set olInsp = Nothing
        Set wdDoc = Nothing
        Set oLink = Nothing
        Exit Sub
    End Sub
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •