unknown
2010-01-05 10:36:37 UTC
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...
Regards,
Onno
Submitted via EggHeadCafe - Software Developer Portal of Choice
Document Compatibility in Internet Explorer 8
http://www.eggheadcafe.com/tutorials/aspnet/5eac37f9-f8a4-40bf-a26b-a7cd299b73c9/document-compatibility-in.aspx
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...
Regards,
Onno
Submitted via EggHeadCafe - Software Developer Portal of Choice
Document Compatibility in Internet Explorer 8
http://www.eggheadcafe.com/tutorials/aspnet/5eac37f9-f8a4-40bf-a26b-a7cd299b73c9/document-compatibility-in.aspx