download
order  

Visual Basic 6 and VBA code fragments for Word

 

In the Visual Basic 6 code fragments below are included in the Code-VB fragments library.
Fragments are snippets of code you can insert in your procedures.
Each item between braces correspond to a variable of the given type.
They are replaced with the new or existing variables by Fragment Builder in Code-VB tools.

Add Bookmark

{Word.Document:wdoc}.Bookmarks.Add {String:strBmkName="SampleBookmark"}, {Word.Range:rng}

Close Word Document Cancel Changes

{Word.Document:wdoc}.Close SaveChanges:=False
Set {Word.Document:wdoc} = Nothing

Create Document

Set {Word.Document:wdoc} = {Word.Application:wapp}.Documents.Add()
With {Word.Application:wapp}
    .Visible = True
    .Activate
    .WindowState = wdWindowStateNormal
End With

Quit

{Word.Application:wApp}.Quit
Set {Word.Application:wApp} = Nothing

Start

Set {Word.Application:wapp} = CreateObject("Word.Application")
With {Word.Application:wapp}
    .Visible = True
    .Activate
    .WindowState = wdWindowStateNormal
End With

Word Start