Outlook version?
FYI, objSel is a Selection object, not a string, so it would be better to
write:
objIEApp.Navigate "http://support.ticket.com?ticid=" & objSel.Text
<Onno de Vries> wrote in message
news:20101553628onno.prive@famdevries.org...
> I've created a macro that should enable me to select part of a text from a
> received email, paste that text to the macro, then that macro will launch
> IE with a full URL with that selected text.
> e.g. selected is '2804837', the URL in the macro is
> "http://www.whatever.com?ticid=". IE will be launched with that URL but
> added to that is the selected text to have a full URL pointing me to the
> exact page.
> See code:
> Sub View_Support_Ticket()
>
> Dim objOL As Application
> Dim objDoc As Object
> Dim objSel As Object
> Dim objIEApp As SHDocVw.InternetExplorer
> Dim dummy As String
>
> Set objOL = Application
> Set objDoc = objOL.ActiveInspector.WordEditor
> Set objSel = objDoc.Windows(1).Selection
> Set objIEApp = CreateObject("InternetExplorer.Application")
>
> objIEApp.Navigate "http://support.ticket.com?ticid=" & objSel
> objIEApp.Visible = True
>
> Set objIEApp = Nothing
>
> End Sub
>
> The problem is that when I select the text in an opened email item (double
> clik on the email message) and lauch the macro I get an error message pop
> up: "Sub or Function not defined". However, when I launch the macro from
> the MS visual basic editor, it runs perfectly...
>
> What am I doing wrong here? Quite a newbe on this btw...