Can't invoke createobject("outlook.application") unless I use createobject("outlook.application","localhost")

I have a new laptop and am having a problem I didn't have previously.

Within a custom form I'm trying

Set oOutlook = createobject("outlook.application")

and it generates an exception.

If I change it to

Set oOutlook = createobject("outlook.application","localhost")

it works.

I've never had to do this before on other machines.

I get a similar problem with VB6. If I add in the Outlook 11 library and try

set oOutlook = new Outlook.application

I get an error

If I change it to

set oOutlook = createobject("outlook.application","localhost")

It works.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hello jasonkneen,

this could've to do with a script blocker in AV software which requires explicit direction [localhost in this case] to the on the caller of create object

hope this helps a bit
jasonkneenAuthor Commented:
I've solved this. The solution was to uninstall office then reinstall - repair did not work.

I'm not sure what the exact problem but it sounds like Outlook wasn't registered properly as an application server. Invoking "word.application" worked but outlook wouldn't unless the "localhost" server was specified.

Not only is my script problem solved but google desktop now shows outlook messages, something it didn't do before so as I thought - the two issues were linked.

Anyway, solution is complete reinstall of office!

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

glad you solved it :)
after reading your comment it looks like a registry issue indeed, would be interesting to kn ow when it started happening maybe an update or something
paq and refund
PAQed with points refunded (500)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.