Link to home
Create AccountLog in
Avatar of Joe Kaminski
Joe KaminskiFlag 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?
Avatar of gery128
gery128
Flag of India image

can you paste some code here? then people will be able to help you.
Avatar of 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
So the problem is only on XP? Is the Office version same on all?
Yes, XP only and Outlook 2007.
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer