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

Run-time error when deploying CDO.Message

Status
Not open for further replies.

ggdev

Programmer
May 29, 2007
12
GB
I have a VB6 application from which I would like to be able to send emails. The application is in use on XP, Vista and Windows 7 PCs.

I have created a new VB application and have used the following code which works fine from VB6 and fine as an exe file on the PC that has VB6 installed on it.

----------------------

Option Explicit

Private Sub Command1_Click()
Dim MyMsg As CDO.Message

Set MyMsg = New CDO.Message

MyMsg.To = "to@mydomain.com"
MyMsg.Subject = "Test subject"
MyMsg.TextBody = "This is the text body"
MyMsg.From = "from@mydomain.com"
MyMsg.CC = "cc@mydomain.com"
MyMsg.BCC = "bcc@mydomain.com"
MyMsg.AddAttachment "c:\test\attachment.txt"

MyMsg.Configuration.Fields.Item(" = 2
MyMsg.Configuration.Fields.Item(" = "relay.plus.net"
MyMsg.Configuration.Fields.Item(" = 25
MyMsg.Configuration.Fields.Update

MyMsg.Send
Set MyMsg = Nothing
End Sub

----------------------

I have used the packaging and deployment wizard and have installed the application on a Windows XP Pro and Windows 7 system and both give the same error ..

Run-time error '-2147024893 (80070003)';
The system cannot find the path specified

----------------------

The project references are as follows:
Visual Basic For Applications
Visual Basic run time objects and procedures
Visual Basic objects and procedures
OLE Automation
Microsoft CDO for Windows 2000 library
Microsoft ActiveX Data Objects 2.5 library
Microsoft CDO 1.21 library

I have included the contents of the setup.lst file created by the 'packaging and deployment' wizard.

----------------------

[Bootstrap]
SetupTitle=Install
SetupText=Copying Files, please stand by.
CabFile=Project1.CAB
Spawn=Setup1.exe
Uninstal=st6unst.exe
TmpDir=msftqws.pdw
Cabs=1

[Bootstrap Files]
File1=@VB6STKIT.DLL,$(WinSysPathSysFile),,,7/14/00 11:00:00 PM,101888,6.0.84.50
File2=@COMCAT.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,5/30/98 11:00:00 PM,22288,4.71.1460.1
File3=@STDOLE2.TLB,$(WinSysPathSysFile),$(TLBRegister),,6/2/99 11:00:00 PM,17920,2.40.4275.1
File4=@ASYCFILT.DLL,$(WinSysPathSysFile),,,3/7/99 11:00:00 PM,147728,2.40.4275.1
File5=@OLEPRO32.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,3/7/99 11:00:00 PM,164112,5.0.4275.1
File6=@OLEAUT32.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,4/11/00 11:00:00 PM,598288,2.40.4275.1
File7=@msvbvm60.dll,$(WinSysPathSysFile),$(DLLSelfRegister),,4/14/08 12:12:00 AM,1384479,6.0.98.2

[IconGroups]
Group0=My Application
PrivateGroup0=-1
Parent0=$(Programs)

[My Application]
Icon1="Project1.exe"
Title1=My Application - SendEmail
StartIn1=$(AppPath)

[Setup]
Title=My Application - SendEmail
DefaultDir=$(ProgramFiles)\Project1
AppExe=Project1.exe
AppToUninstall=Project1.exe

[Setup1 Files]
File1=@VB6.OLB,$(WinSysPath),,$(Shared),6/23/98 11:00:00 PM,295514,0.0.0.0
File2=@Project1.vbw,$(AppPath),,,11/29/10 1:43:56 PM,48,0.0.0.0
File3=@Project1.vbp,$(AppPath),,,11/29/10 12:39:48 PM,1117,1.0.0.0
File4=@Form1.frm,$(AppPath),,,11/29/10 12:21:20 PM,6564,0.0.0.0
File5=@attachment.txt,$(AppPath),,,11/25/10 6:05:58 PM,22,0.0.0.0
File6=@MDAC_TYP.EXE,$(WinSysPath),,$(Shared),1/19/00 11:00:00 PM,7856352,25.0.4403.12
File7=@CDO.DLL,$(WinSysPath),,$(Shared),6/19/00 7:12:10 PM,808720,5.5.2652.65
File8=@cdosys.dll,$(WinSysPath),$(DLLSelfRegister),$(Shared),4/14/08 12:11:50 AM,2091520,6.2.4.0
File9=@Project1.exe,$(AppPath),,,11/29/10 12:39:54 PM,24576,1.0.0.0

----------------------

I would appreciate any help or advice that anyone can give me. Thank you in advance.
 

You may want to have an error handler in your code. This way you may know which line of code has the problem.

Have fun.

---- Andy
 
Thank you for your comment. I did add an error handler and found the problem. I was way off track looking for a complex cause.

The test systems didn't have the path for the attachment. A case of 'not being able to see the wood for the trees'.

Thank you once again.
 
It may be worth pointing out that neither CDONTS (CDO 1.21) nor CDOSYS (Microsoft CDO for Windows 2000) are redistributable, so you should not be including them in your package.

XP, Vista and Windows 7 should already have CDOSYS installed.
 
Thank you for the advice strongm.
I have since tested on other PCs and found the send email program runs okay without running an installation package.
 
I'm not sure why the source files were being deployed either.

Normally you'd want a deployment package anyway to install into Program Files, create a Start Menu shortcut, provide an uninstall, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top