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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

runtime error -1073741819, automation

Status
Not open for further replies.

rozzay

Programmer
Joined
Jan 3, 2002
Messages
142
Location
US
Hi I have a program where it emails a certain request. the program works fine at my pc and I have 2 other users who uses it but their pc are different running on windows nt 4.0 (mine is windows 2000). I had to package the program and the users copy and paste the .exe to their desktop. Well one user can use the program fine while the other is able to login and type in their request but when it is time to submit(email) the request a runtime error -1073741819 occurs automation error. I am unfamilar with this error. I tried looking it up on the web and it mentioned fox pro, but i don't think I am using it that i know of and i am also unfamiliar with fox pro. why is it one of my user is able to use my program successfully while another receives an error?? What should i be looking for to find out why the error occurs?? Please help, very confused!!
 
I assume you are automating Outlook. Are they both the same version/service pack level? Have you used code specific to a particular version? e.g. setting email format to rich text will only work on Outlook 10.

Try issuing a test version that will display what it is doing so you can identify the line where the problem occurs. For instance, put a label on your form and update it whenever you do anything with Outlook.
 
Thanks for your info i have couple questions how would I know if they are both the same version/service pack? I don't think I used a particular code to specific Outlook version. But the error log did point to this particular proc where the error occurred:

Private Sub EmailData()
On Error GoTo SubError
Dim objOutlook As New Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim Today
Today = Now
txtSubject.Text = txtSubject.Text & strSubject
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
.To = txtTO.Text
.CC = txtCC.Text
.Subject = txtSubject.Text
.Body = strMail
.Send

End With

MsgBox "Auto Email Complete", vbInformation

Set objOutlookMsg = Nothing
Set objOutlook = Nothing

Exit Sub
SubError:
Call OptError(mstrFrmName, mstrErrMsg, "EmailData")
End Sub

I don't think it is the code since I am able to email..thank you for your help so much...
 
As you have declared a variable as Outlook.Application you must have set a reference to the Outlook object model - the version that is installed on your development machine.

To avoid version-specificness (is that a word?!!) use late binding as follows:
Code:
Dim MyOLApp As Object
Dim MyOLMsg As Object
Set MyOLApp = CreateObject("Outlook.Application")
...

I usually find it is easier to use the reference while you are designing so you get the full object library and Intellisense prompting, but then modify your code to use late binding before issue. Don't forget that any constants you use must be declared manually e.g. olMailItem.
 
Okay i found out that one user has the same version of outlook and the other user is using Outlook 97. I have Outlook 98 and in my reference i am referencing to outlook 98 library. anyways I tried your method and I receive an runtime error '438' the object does not support this method. Below is my codes so far..

Private Sub EmailData()
Dim MyOLApp As Object
Dim MyOLMsg As Object
Set MyOLApp = CreateObject("Outlook.Application")
txtSubject.Text = txtSubject.Text & strSubject
With MyOLApp
.To = txtTO.Text
.CC = txtCC.Text
.Subject = txtSubject.Text
.Body = strMail
.Send
End With
MsgBox "Auto Email Complete", vbInformation
Set MyOLApp = Nothing
Set MyOLMsg = Nothing

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top