Article ID: 154456
Article Last Modified on 10/11/2006
Function CloseDoc ()
Dim wordobj As Object
Set wordobj = CreateObject("Word.Basic")
wordobj.FileOpen "C:\Winword\Test.doc"
' View the invoked instance of Word.
wordobj.AppShow
' Selects the entire document and makes it Bold.
wordobj.EditSelectAll
wordobj.Bold 1
' Closes the document and saves changes.
wordobj.filesave
wordobj.FileClose (1)
wordobj.appclose
Set wordobj = Nothing
End Function
?Closedoc()
Note that the object is opened, formatted, saved, and then closed.
Dim WordObj as Object
Me![OLEObj].Verb = -2 ' Tells Microsoft Access to open the
' application.
Me![OLEObj].Action = 7 ' Activates the application.
Set WordObj = Me![OLEObj].Object.Application.WordBasic
WordObj.EditSelectAll
WordObj.Bold 1
Wordobj.FileSave
WordObj.FileClose(1)
Wordobj.Appclose
Set WordObj = Nothing
Keywords: kbhowto kbinterop kbprogramming KB154456