GeekGirlau
Programmer
AAAAAAAAAAGGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHH!
Sorry, had to get that out of my system.
I'm having trouble with using GetObject to manipulate Word from Access.
Sample:
Function StupidWord()
Dim objWord as Word.Application
On Error Goto ErrHandle
Set objWord = GetObject(, "Word.Application"
With objWord
.Visible = True
.Activate
End With
ExitRamp:
On Error Resume Next
Set objWord = Nothing
Exit Function
ErrHandle:
Select Case Err.Number
Case 91, 429
Err.Clear
Set objWord = CreateObject("Word.Application"
Resume Next
Case Else
MsgBox Err.Number & ": " & Err.Description
Resume ExitRamp
End Select
End Function
Problem is, it doesn't work (although the identical code using Excel works fine). I get error 429 as soon as I try to do CreateObject.
Currently I'm having to use Shell to launch Word instead of CreateObject, and replacing Resume Next with Resume. This occassionally decides to open Word twice before successfully using the GetObject command. I've tried dimensioning objWord as an Object rather than Word.Application, with no success.
I should also explain that I'm working with a large organisation with a standard installation procedure for Office, so I have zero flexibility for changing the way that Word and/or Access have been installed.
HELP!!!!!!!!
Sorry, had to get that out of my system.
I'm having trouble with using GetObject to manipulate Word from Access.
Sample:
Function StupidWord()
Dim objWord as Word.Application
On Error Goto ErrHandle
Set objWord = GetObject(, "Word.Application"
With objWord
.Visible = True
.Activate
End With
ExitRamp:
On Error Resume Next
Set objWord = Nothing
Exit Function
ErrHandle:
Select Case Err.Number
Case 91, 429
Err.Clear
Set objWord = CreateObject("Word.Application"
Resume Next
Case Else
MsgBox Err.Number & ": " & Err.Description
Resume ExitRamp
End Select
End Function
Problem is, it doesn't work (although the identical code using Excel works fine). I get error 429 as soon as I try to do CreateObject.
Currently I'm having to use Shell to launch Word instead of CreateObject, and replacing Resume Next with Resume. This occassionally decides to open Word twice before successfully using the GetObject command. I've tried dimensioning objWord as an Object rather than Word.Application, with no success.
I should also explain that I'm working with a large organisation with a standard installation procedure for Office, so I have zero flexibility for changing the way that Word and/or Access have been installed.
HELP!!!!!!!!