jimwal0367
Programmer
Is it possible to open an exisiting word document like letter.doc by using an a macro in attachmate. I have the code for opening a blank word document see below.
Sub Main()
' Declare Object Variables
Dim objApp As Object
Dim objDoc As Object
Dim objRange As Object
'if word not running, GetObject(...) will return a 429 error.
'Therefore tell macro to keep running if an error raised
On Error Resume Next
'try to grab a reference to an open instance of word
Set objApp = GetObject(, "Word.Application.8")
'if getobject(..) failed to return an object, then
If objApp Is Nothing Then
Set objApp = CreateObject("Word.Application.8")
'if objApp is still nothing, word is not installed. Exit the macro
If objApp Is Nothing Then Exit Sub
End If
'make word visible to user
objApp.Visible = True
'Create a new, blank, untitled document and assign it to objDoc
Set objDoc = objApp.Documents.Add
End Sub
Thanks
jimwal0367
Sub Main()
' Declare Object Variables
Dim objApp As Object
Dim objDoc As Object
Dim objRange As Object
'if word not running, GetObject(...) will return a 429 error.
'Therefore tell macro to keep running if an error raised
On Error Resume Next
'try to grab a reference to an open instance of word
Set objApp = GetObject(, "Word.Application.8")
'if getobject(..) failed to return an object, then
If objApp Is Nothing Then
Set objApp = CreateObject("Word.Application.8")
'if objApp is still nothing, word is not installed. Exit the macro
If objApp Is Nothing Then Exit Sub
End If
'make word visible to user
objApp.Visible = True
'Create a new, blank, untitled document and assign it to objDoc
Set objDoc = objApp.Documents.Add
End Sub
Thanks
jimwal0367