Joe Kaminski
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?
can you paste some code here? then people will be able to help you.
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.Ol ItemType.o lMailItem)
oMsg.To = "Person1@Company.com"
oMsg.CC = "Person2@Company.com"
oMsg.Subject = "Customer Service Shipping Release, PO " & dgvCustomerOrders.CurrentR ow.Cells(" dgvCustome rOrders_Pu rchaseOrde rID").Valu e
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.CurrentR ow.Cells(" dgvCustome rOrders_Pa tternDescr iption").V alue & vbCr
oMsg.Body += "Yardage:" & vbTab & vbTab & txtMemoYardage.Text & vbCr
strMemosReleased = Nothing
For Each dgvrTemporary As DataGridViewRow In dgvMemos.Rows
If dgvrTemporary.Cells("dgvMe mos_Select ion").Edit edFormatte dValue = False Then Continue For
strMemosReleased += dgvrTemporary.Cells("dgvMe mos_Memo") .Value & " "
Next
oMsg.Body += "Memos:" & vbTab & vbTab & strMemosReleased
oMsg.Body += "Shipping Instructions:" & vbTab & vbCr
oMsg.Display()
oApp = Nothing
oMsg = Nothing
End Sub
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.Ol
oMsg.To = "Person1@Company.com"
oMsg.CC = "Person2@Company.com"
oMsg.Subject = "Customer Service Shipping Release, PO " & dgvCustomerOrders.CurrentR
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.CurrentR
oMsg.Body += "Yardage:" & vbTab & vbTab & txtMemoYardage.Text & vbCr
strMemosReleased = Nothing
For Each dgvrTemporary As DataGridViewRow In dgvMemos.Rows
If dgvrTemporary.Cells("dgvMe
strMemosReleased += dgvrTemporary.Cells("dgvMe
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?
ASKER
Yes, XP only and Outlook 2007.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.