×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VBA calling VBS gives "ActiveX component cant create object"

VBA calling VBS gives "ActiveX component cant create object"

VBA calling VBS gives "ActiveX component cant create object"

(OP)
Hi folks,

I am a newbie in using VB family of languages. I wrote a .NET dll which creates a process (objProcess.Start()) in one function and returns the pid and then in second function I pass the pid and monitor it using objProcess.WaitForExit(). I exposed it to the COM and registered it using REGASM with /tlb and /Codebase option. Then wrote a small VB script as shown: Lets call is TEST.vbs

CODE

Set objProc = CreateObject("CreateANDMonitor.Class1")
pid = objProc.fncCreate("calc.exe")
objProc.fncMonitor(pid)
msgbox "process ended"
Set objProc = Nothing

I double click the TEST.vbs and it launches the calc adn when I close cals it pops up the message. Everything is good till now :thumb:

Now I want to call this script from and out look macro, so I created one in outlook

CODE

Public Sub main()
 Shell "wscript C:\.....\TEST.vbs"
End Sub

If I do this I get the following error

CODE

MSG: ActiveX component cant create object: "CreateANDMonitor.Class1"
CODE: 800A01AD


Why the script is running fine by itself and not when called from an Outlook Macro.

Help will be highly appreciated.
HN

RE: VBA calling VBS gives "ActiveX component cant create object"

At a guess, if the DLL is not in the same directory as the script, it DLL needs to be registered first.

regsvr32 dllpath

RE: VBA calling VBS gives "ActiveX component cant create object"

Check with the geeks over at Tek-tips.com a sister to this site.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close