Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to open hyperlink from email getting run time error 91

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I am using outlook 2010 and Access 2010. I click on a button in access that goes to the test Subroutine. I am trying to open a hyperlink that is in an email I get every day. I am getting an error 91 object not set. I have tried many different ways of using the email object with no success. I am hoping to get some assistance. My goal is to open the hyperlink in this email which goes to an excel file. After the excel file is open I would like to save it in a folder that exists called C:\DOR_Files\Daily_Net_Adds

The hyperlink is
The subject in the email is Northeast Daily Net Adds -April 2015

Any help is appreciated
Tom


Code:
Sub LaunchURL(itm As MailItem)

    Dim bodyString As String
    Dim bodyStringSplitLine
    Dim bodyStringSplitWord
    Dim splitLine
    Dim splitWord

    bodyString = itm.Body
    bodyStringSplitLine = Split(bodyString, vbCrLf)

    For Each splitLine In bodyStringSplitLine
        bodyStringSplitWord = Split(splitLine, " ")

        For Each splitWord In bodyStringSplitWord
            If Left(splitWord, 7) = "[URL unfurl="true"]http://"[/URL] Then
                Shell ("C:\Program Files\Internet Explorer\IEXPLORE.EXE" & " " & splitWord)
            End If
        Next

    Next

    Set itm = Nothing

End Sub


Public Sub test()
    Dim currItem As MailItem
    Set currItem = ActiveInspector.CurrentItem
    LaunchURL currItem
End Sub
 
I guess the error is about ActiveInspector.
You should create an Outlook.Application object to manipulate ActiveInspector

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
vba317 said:
open the hyperlink in this email which goes to an excel file. After the excel file is open I would like to save it in a folder that exists

Looks to me like you just want to Download File from web using VBA


Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top