Problems since i change to Vista

S

SteM

Hi all,
since i installled Vista I started to have problems launching Word2000 from
VBA Access.
In any case I noted a difference between Winword2000 and other Office
programs:
on the normal launch Word shows a window for 'user account control', Cancel,
Allow (or something like that, mine is not in english).
Running Excel, Powerpoint and others, not.

I need to run Word2000 from a vba macro in Access2000: no problem with XP or
Win2000.
If i call a 'new Word.Application' or 'Shell("c:\xxxx\winword.exe')' i have
the error:
Function call or argument not valid
or
Automation Error
To execute the requested operation is needed a higher rights.

If i change using 'calc' or 'notepad' there are no problems.

If I put Word in other folder (ex. c:\tmp\winword.exe) Shell() is able to
run it but then i need to get the variable to control the program:
if I call GetObject(,"Word.Application") I get error 13.

What happens ???
How can i solve?
Any idea?
 
S

SteM

Now i'm alble to run winword by Shell() function but I don't know how to get
the handle to the application (appWord) to automate it.
This is my tests:

--------------------------------------------------------------------
On Error Resume Next
AppActivate "Microsoft Word"
If Err Then 'If not running ...

Debug.Print "AppActivate: " & Err.Description
Err.Clear

Dim wID
wID = Shell("winword.exe", vbNormalFocus)
If Err Then
Debug.Print "Shell: " & Err.Description
Else
Debug.Print "Shell: OK"
End If

Set appWord = GetObject(, "Word.Application")
If Err Then
Debug.Print "GetObject: " & Err.Description
Else
Debug.Print "GetObject: OK"
End If

Set appWord = GetObject(, "{000209FF-0000-0000-C000-000000000046}")
If Err Then
Debug.Print "GetObjectID: " & Err.Description
Else
Debug.Print "GetObjectID: OK"
End If

Err.Clear
Set appWord = CreateObject("Word.Application")
If Err Then
Debug.Print "CreateObject: " & Err.Description
Else
appWord.Visible = True
End If

Err.Clear
Set appWord = New Word.Application
If Err Then
Debug.Print "New: " & Err.Description
Else
appWord.Visible = True
appWord.WindowState = Word.wdWindowStateMaximize
End If
Else
Set appWord = GetObject(, "Word.Application")
End If

AppActivate "{000209FF-0000-0000-C000-000000000046}" 'Word
If Err Then
Debug.Print "AppActivateID: " & Err.Description
End If

Err.Clear
AppActivate "Microsoft Word"
If Err Then
Debug.Print "AppActivate2: " & Err.Description
On Error GoTo 0
MsgBox "Word not found !!", vbCritical
Exit Sub
End If

On Error GoTo 0

-----------------
This is the output:

AppActivate: Chiamata di routine o argomento non validi (Function call or
argument not valid)
Shell: OK
GetObject: Tipo non corrispondente (Type not corrisponding)
GetObjectID: Il componente ActiveX non è in grado di creare l'oggetto
(ActiveX component not able to create the object)
CreateObject: Tipo non corrispondente (Type not corrisponding)
New: La classe non supporta l'automazione o l'interfaccia prevista. (The
class doesn't support automation or interface)
AppActivateID: Chiamata di routine o argomento non validi (Function call or
argument not valid)
AppActivate2: Chiamata di routine o argomento non validi (Function call or
argument not valid)


I checked on the registry and both "Word.Application" and the relative CLSID
are present.

Any idea ??
 
S

SteM

I noted that, even if they return error, both CreateObject() and new
Word.Application run an invisibile Word instance !!
I see them between the processes but I have a Nothing into the object
variable!

CreateObject() returns error13, new returns error 430.

???
 
S

SteM

I hope to have solved the problem simply changing the type of the
application variable:
from Word.Application to Object (.. late binding ..) (???).
Now it's running....
 

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