Avatar of Joe Kaminski
Joe Kaminski
Flag for United States of America asked on

vb.net launching Outlook 2007

I am trying to programatically launch Outlook 2007 from a Visual Basic program.  The code works fine on Windows Vista and Windows 7, however, I get a "error 0x80004004" on Windows XP.  Any thoughts?
Microsoft DevelopmentOutlookVisual Basic.NET.NET ProgrammingVisual Basic Classic

Avatar of undefined
Last Comment
Nasir Razzaq

8/22/2022 - Mon
gery128

can you paste some code here? then people will be able to help you.
Joe Kaminski

ASKER
Here is the code:
    Private Sub btnSendEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSendEmail.Click
        Dim oApp As Outlook._Application
        Dim strMemosReleased As String
        oApp = New Outlook.Application()

        Dim oMsg As Outlook._MailItem
        oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)
        oMsg.To = "Person1@Company.com"
        oMsg.CC = "Person2@Company.com"
        oMsg.Subject = "Customer Service Shipping Release, PO " & dgvCustomerOrders.CurrentRow.Cells("dgvCustomerOrders_PurchaseOrderID").Value
        oMsg.Body = "Ship Date:             " & vbCr
        oMsg.Body += "Credit Approved?:      " & vbCr
        oMsg.Body += "Shipping Company:      " & vbCr
        oMsg.Body += "Freight Costs:         " & vbCr
        oMsg.Body += "Pattern:" & vbTab & vbTab & dgvCustomerOrders.CurrentRow.Cells("dgvCustomerOrders_PatternDescription").Value & vbCr
        oMsg.Body += "Yardage:" & vbTab & vbTab & txtMemoYardage.Text & vbCr
        strMemosReleased = Nothing
        For Each dgvrTemporary As DataGridViewRow In dgvMemos.Rows
            If dgvrTemporary.Cells("dgvMemos_Selection").EditedFormattedValue = False Then Continue For
            strMemosReleased += dgvrTemporary.Cells("dgvMemos_Memo").Value & " "
        Next
        oMsg.Body += "Memos:" & vbTab & vbTab & strMemosReleased
        oMsg.Body += "Shipping Instructions:" & vbTab & vbCr

        oMsg.Display()

        oApp = Nothing
        oMsg = Nothing

    End Sub
Nasir Razzaq

So the problem is only on XP? Is the Office version same on all?
Your help has saved me hundreds of hours of internet surfing.
fblack61
Joe Kaminski

ASKER
Yes, XP only and Outlook 2007.
ASKER CERTIFIED SOLUTION
Nasir Razzaq

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.