CreateObject() failes after upgrade for Outlook 2002 to Outlook 2003

M

Mike Kiefer

I had the following code which worked perfectly before I
upgraded from Outlook 2002 to Outlook 2003. Execution
fails on the CreateObject() call, with the error: "Can't
find this file. Make sure the path and file name are
correct."

The object referenced is a COM object that uses the .NET
Framework to send an email. The file still exists and the
registration of the object is still in the registry.
Nothing has changed on it in over a year. Macro security
is set to "Low". Other than the installation of Office
2003, nothing else on the machine has changed. I'm
wondering why this code is suddenly failing. Any
suggestions?


Sub TestMailSend()
On Error GoTo ErrorHandler
quoteBefore = " """
quoteAfter = """ "
Dim mailer As Object
Set mailer = CreateObject
("MDKMail.MailSender")
If (TypeName(mailer) <> "Nothing") Then
Call mailer.SendPlainText
("(e-mail address removed)", "(e-mail address removed)", _
"Totally new
subject", _
"Wow!, it
works!")
Else
MsgBox "Create of MDKMail object failed!"
End If

Exit Sub
ErrorHandler:
MsgBox Error$
Resume Next
End Sub
 
M

Mike Kiefer

I figured it out, but I wish I understood more why this
happened.

Apparently, the CreateObject() function in Outlook only
looks in the c:\Program Files\Microsoft Office\Office11
directory for the DLLs. When I installed Office 2003 it
didn't copy those custom Dlls from ...\Office10 so the
function was failing. I managed to track this down using
a file-open monitor.
 
W

Wei-Dong Xu [MSFT]

Hi Mike,

So far as I know on this issue, CreateObject will create and return a
reference to an ActiveX object. ActiveX object is an exposed object of the
Component Object Model(COM) which can be used by other applications or
programming tools through Automation interfaces. ActiveX object should be
registered in the windows registry so that other application or programming
tools can find it through registry. From your description, the registry
information of the customized ActiveX object may have been affected for
some reason so that your code will report error. I'd suggest you can use
Regsvr32 to register the component again. Then test your code.

If your component is located in c root, you can use the command below to
register it in console window. I assume the name of component is
Sendmail.dll.
regsvr32 c:\Sendmail.dll

After that, please test your codes again.

If you have any further question, please feel free to let me know

Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top