Error: 'ActiveX can't create object' on OSX

S

Sabine

Hi,

I'm not really experienced in VBA but most of the time getting there with
lots of googeling. The problem I'm experiencing right now is not so common I
guess because I couldn't find any hint on what to do on a Mac.

Here's what I'm trying to accomplish:
From Excel X on OSX 10.2.8 I'm trying to 'transfer' some data into a Word X
doc but I can't seem to get Excel to CreateObject("Word.Application"), it
keeps returning the error "ActiveX can't create object".

What I've found on the net is that if this error occurs in a
Windows-environment, your version of Visual Basic is probably outdated. What
I didn't find was how to update this on a Mac. So what I would like to know
is, is my assumption correct that my version of VB is outdated and if so,
where can I get an update? If not, what else could be wrong.

If needed I can post my code.

Kind regards,
Sabine Visser
 
J

JE McGimpsey

Sabine said:
What I've found on the net is that if this error occurs in a
Windows-environment, your version of Visual Basic is probably outdated. What
I didn't find was how to update this on a Mac. So what I would like to know
is, is my assumption correct that my version of VB is outdated and if so,
where can I get an update? If not, what else could be wrong.

Yes, you're correct. No, you can't update - MacOffice VBA is still at
version 5. As noted above, updating wouldn't help in any case.

Try something like:

Dim oWordApp As Object
On Error Resume Next
Set oWordApp = GetObject(, "Word.Application")
If oWordApp Is Nothing Then _
Set oWordApp = CreateObject("Word.Application")
On Error GoTo 0
Range("A1:A10").Copy
With oWordApp
.Documents.Add
.Selection.Paste
End With

Since applications are single-instance objects, CreateObject will not
create a separate instance of Word. It's usually more efficient to check
GetObject() to see if Word's running, first...
 
S

Sabine

JE, you are brilliant! Thanks a million, this works perfectly!

Regards,
Sabine (big smile)))))
 

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