Chapter 9: VBA- Dialog Boxes and API Calls

            One time-saving feature of VBA is its ability to create forms and dialog boxes to gather data for your programs. There are also built-in dialog boxes in both Word and in Windows which can extend your EMR's capabilities tremendously.

Word’s Built-In Dialog Boxes- MsgBox ( ) Function

The objective of MsgBox is to produce a pop-up message box and prompt the user to click on a command button before he /she can continues. This message box format is as follows: MsgBox(Prompt, Style Value, Title). Here is a code sample:

intReturn = MsgBox("Do you wish to delete this record?", vbQuestion + vbYesNo, "Add Appointments Form")

The first argument, Prompt, will display the message in the message box. The Style Value  will determine what type of command buttons appear on the message box, please refer Table 10.1 for types of command button displayed. The Title argument will display the title of the message board. Here is a table delineating the various style values: 

Constant

Style Value

Buttons Displayed

vbOKOnly

0

Display OK button only.

vbOKCancel

1

  OK and Cancel buttons.

vbAbortRetryIgnore

2

  Abort, Retry, and Ignore buttons.

vbYesNoCancel

3

 Yes, No, and Cancel buttons.

vbYesNo

4

 Yes and No buttons.

vbRetryCancel

5

 Retry and Cancel buttons.

vbCritical

16

 Critical Message icon.

vbQuestion

32

 Warning Query icon.

vbExclamation

48

 Warning Message icon.

vbInformation

64

Information Message icon.

vbDefaultButton1

0

First button is default.

vbDefaultButton2

256

Second button is default.

vbDefaultButton3

512

Third button is default.

vbDefaultButton4

768

Fourth button is default.

vbApplicationModal

0

Application modal; the user must respond to the message box before continuing work in the current application.

vbSystemModal

4096

System modal; all applications are suspended until the user responds to the message box.

vbMsgBoxHelpButton

16384

Adds Help button to the message box

VbMsgBoxSetForeground

65536

Specifies the message box window as the foreground window

vbMsgBoxRight

524288

Text is right aligned

vbMsgBoxRtlReading

1048576

Specifies text should appear as right-to-left reading on Hebrew and Arabic systems

You can use a named constant in place of integers for the second argument to make the programs more readable. For example,  you can use either  “0” or “vbOKOnly”.

In the sample shown on the preceding page, intReturn is variable that holds values that are returned by the MsgBox ( ) function.  Here is a code sample:


 

intReturn = MsgBox("Diagnosis " & Chr(34) & strAuth & Chr(34) & " is not in the system." & "   Do you want to add this diagnosis?", vbQuestion + vbYesNo, "Add Diagnosis Form")

If intReturn = vbYes Then

    DoCmd.OpenForm FormName:="DxAddP", DataMode:=acAdd, WindowMode:=acDialog, OpenArgs:=strAuth

    Response = acDataErrAdded

Exit Sub

End If

Response = acDataErrDisplay

            Here is how this sample looks like:

 

Word’s Built-In Dialog Boxes- The InputBox( ) Function

An InputBox( ) function will display a message box where the user can enter a value or a message in the form of text. The format is myMessage=InputBox(Prompt, Title, default_text, x-position, y-position). Here is a code sample:

    ' Initialize string.

    strMsg = "The [LUNAME] (i.e. lookup name field) is empty." & Chr(13) & "Press OK to enter a new value."

    ' Prompt user for input.

    strInput = InputBox("Enter in a new value for the empty [LUNAME] field." & Chr(13) & "The [LUNAME] consists of 1st 4 letters of the patient " & Chr(13) & "last name plus the 1st 4 letters of the patient first" & Chr(13) & "name and the numbers representing the patient" & Chr(13) & " date of birth. Example: the LookUp Name for this " & Chr(13) & "patient would normally beà  " & Left([LNAME], 4) & Left([FNAME], 4) & MONTH([DOB]) & Day([DOB]) & YEAR([DOB]))

    ' Determine if user chose "Cancel".

    If strInput <> "" Then

        ' Test value of user input.

        'strmsg = Left([LNAME], 4) & Left([FNAME], 4) & MONTH([DOB]) & Day([DOB]) & YEAR([DOB])

        Do While Len(strInput) < 2

            If MsgBox(strMsg, vbOKCancel, "Error!") = vbOK Then

                strInput = InputBox("Enter in a new value for the [LUNAME].")

            Else

                Exit Sub

            End If

        Loop

        ' Display user's correct input.

        MsgBox "You entered this value for the [LUNAME]: " & strInput & "."

        [LUNAME] = strInput

        Forms![*Genl Info & Insurance]![Combo211] = Forms![*Genl Info & Insurance]![LUNAME]

    Else

        Exit Sub

    End If

      The strMsg variable is a variant data type but typically it is declared as string, which accept the message input by the users. The arguments are explained as follows:

  • Prompt  - The message displayed normally as a question asked.

  • Title  - The title of the Input Box.

  • default-text  - The default text that appears in the input field where users can use it as his intended input or he may change to the message he wish to key in.

  • x-position and y-position - the position or the coordinate of the input box.

            Here is how this sample looks like:

 

            Word and Windows have numerous built-in dialog boxes which can extend the power of vba. Many of the built-in Word dialog boxes have arguments that you can also use to set or get values from a dialog box. The following is a list of all the dialog boxes with their respective arguments:

WdWordDialog constant Argument list(s)
wdDialogConnect Drive, Path, Password
wdDialogConsistencyChecker (none)
wdDialogControlRun Application
wdDialogConvertObject IconNumber, ActivateAs, IconFileName, Caption, Class, DisplayIcon, Floating
wdDialogCopyFile FileName, Directory
wdDialogCreateAutoText (none)
wdDialogCSSLinks LinkStyles
wdDialogDocumentStatistics FileName, Directory, Template, Title, Created, LastSaved, LastSavedBy, Revision, Time, Printed, Pages, Words, Characters, Paragraphs, Lines, FileSize
wdDialogDrawAlign Horizontal, Vertical, RelativeTo
wdDialogDrawSnapToGrid SnapToGrid, XGrid, YGrid, XOrigin, YOrigin, SnapToShapes, XGridDisplay, YGridDisplay, FollowMargins, ViewGridLines, DefineLineBasedOnGrid
wdDialogEditAutoText Name, Context, InsertAs, Insert, Add, Define, InsertAsText, Delete, CompleteAT
wdDialogEditCreatePublisher (For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.)
wdDialogEditFind Find, Replace, Direction, MatchCase, WholeWord, PatternMatch, SoundsLike, FindNext, ReplaceOne, ReplaceAll, Format, Wrap, FindAllWordForms, MatchByte, FuzzyFind, Destination, CorrectEnd, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl
wdDialogEditFrame Wrap, WidthRule, FixedWidth, HeightRule, FixedHeight, PositionHorz, PositionHorzRel, DistFromText, PositionVert, PositionVertRel, DistVertFromText, MoveWithText, LockAnchor, RemoveFrame
wdDialogEditGoTo Find, Replace, Direction, MatchCase, WholeWord, PatternMatch, SoundsLike, FindNext, ReplaceOne, ReplaceAll, Format, Wrap, FindAllWordForms, MatchByte, FuzzyFind, Destination, CorrectEnd, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl
wdDialogEditGoToOld (none)
wdDialogEditLinks UpdateMode, Locked, SavePictureInDoc, UpdateNow, OpenSource, KillLink, Link, Application, Item, FileName, PreserveFormatLinkUpdate
wdDialogEditObject Verb
wdDialogEditPasteSpecial IconNumber, Link, DisplayIcon, Class, DataType, IconFileName, Caption, Floating
wdDialogEditPublishOptions (For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.)
wdDialogEditReplace Find, Replace, Direction, MatchCase, WholeWord, PatternMatch, SoundsLike, FindNext, ReplaceOne, ReplaceAll, Format, Wrap, FindAllWordForms, MatchByte, FuzzyFind, Destination, CorrectEnd, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl
wdDialogEditStyle (none)
wdDialogEditSubscribeOptions (For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.)
wdDialogEditSubscribeTo (For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.)
wdDialogEditTOACategory Category, CategoryName
wdDialogEmailOptions (none)
wdDialogFileDocumentLayout Tab, PaperSize, TopMargin, BottomMargin, LeftMargin, RightMargin, Gutter, PageWidth, PageHeight, Orientation, FirstPage, OtherPages, VertAlign, ApplyPropsTo, Default, FacingPages, HeaderDistance, FooterDistance, SectionStart, OddAndEvenPages, DifferentFirstPage, Endnotes, LineNum, StartingNum, FromText, CountBy, NumMode, TwoOnOne, GutterPosition, LayoutMode, CharsLine, LinesPage, CharPitch, LinePitch, DocFontName, DocFontSize, PageColumns, TextFlow, FirstPageOnLeft, SectionType, RTLAlignment
wdDialogFileFind SearchName, SearchPath, Name, SubDir, Title, Author, Keywords, Subject, Options, MatchCase, Text, PatternMatch, DateSavedFrom, DateSavedTo, SavedBy, DateCreatedFrom, DateCreatedTo, View, SortBy, ListBy, SelectedFile, Add, Delete, ShowFolders, MatchByte
wdDialogFileMacPageSetup (For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.)
wdDialogFileNew Template, NewTemplate, DocumentType, Visible
wdDialogFileOpen Name, ConfirmConversions, ReadOnly, LinkToSource, AddToMru, PasswordDoc, PasswordDot, Revert, WritePasswordDoc, WritePasswordDot, Connection, SQLStatement, SQLStatement1, Format, Encoding, Visible, OpenExclusive, OpenAndRepair, SubType, DocumentDirection, NoEncodingDialog, XMLTransform
wdDialogFilePageSetup Tab, PaperSize, TopMargin, BottomMargin, LeftMargin, RightMargin, Gutter, PageWidth, PageHeight, Orientation, FirstPage, OtherPages, VertAlign, ApplyPropsTo, Default, FacingPages, HeaderDistance, FooterDistance, SectionStart, OddAndEvenPages, DifferentFirstPage, Endnotes, LineNum, StartingNum, FromText, CountBy, NumMode, TwoOnOne, GutterPosition, LayoutMode, CharsLine, LinesPage, CharPitch, LinePitch, DocFontName, DocFontSize, PageColumns, TextFlow, FirstPageOnLeft, SectionType, RTLAlignment, FolioPrint, ReverseFolio, FolioPages
wdDialogFilePrint Background, AppendPrFile, Range, PrToFileName, From, To, Type, NumCopies, Pages, Order, PrintToFile, Collate, FileName, Printer, OutputPrinter, DuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight, ZoomPaper
wdDialogFilePrintOneCopy (For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.)
wdDialogFilePrintSetup Printer, Options, Network, DoNotSetAsSysDefault
wdDialogFileRoutingSlip Subject, Message, AllAtOnce, ReturnWhenDone, TrackStatus, Protect, AddSlip, RouteDocument, AddRecipient, OldRecipient, ResetSlip, ClearSlip, ClearRecipients, Address
wdDialogFileSaveAs Name, Format, LockAnnot, Password, AddToMru, WritePassword, RecommendReadOnly, EmbedFonts, NativePictureFormat, FormsData, SaveAsAOCELetter, WriteVersion, VersionDesc, InsertLineBreaks, AllowSubstitutions, LineEnding, AddBiDiMarks
wdDialogFileSaveVersion (none)
wdDialogFileSummaryInfo Title, Subject, Author, Keywords, Comments, FileName, Directory, Template, CreateDate, LastSavedDate, LastSavedBy, RevisionNumber, EditTime, LastPrintedDate, NumPages, NumWords, NumChars, NumParas, NumLines, Update, FileSize
wdDialogFileVersions AutoVersion, VersionDesc
wdDialogFitText FitTextWidth
wdDialogFontSubstitution UnavailableFont, SubstituteFont
wdDialogFormatAddrFonts Points, Underline, Color, StrikeThrough, Superscript, Subscript, Hidden, SmallCaps, AllCaps, Spacing, Position, Kerning, KerningMin, Default, Tab, Font, Bold, Italic, DoubleStrikeThrough, Shadow, Outline, Emboss, Engrave, Scale, Animations, CharAccent, FontMajor, FontLowAnsi, FontHighAnsi, CharacterWidthGrid, ColorRGB, UnderlineColor, PointsBi, ColorBi, FontNameBi, BoldBi, ItalicBi, DiacColor
wdDialogFormatBordersAndShading ApplyTo, Shadow, TopBorder, LeftBorder, BottomBorder, RightBorder, HorizBorder, VertBorder, TopColor, LeftColor, BottomColor, RightColor, HorizColor, VertColor, FromText, Shading, Foreground, Background, Tab, FineShading, TopStyle, LeftStyle, BottomStyle, RightStyle, HorizStyle, VertStyle, TopWeight, LeftWeight, BottomWeight, RightWeight, HorizWeight, VertWeight, BorderObjectType, BorderArtWeight, BorderArt, FromTextTop, FromTextBottom, FromTextLeft, FromTextRight, OffsetFrom, InFront, SurroundHeader, SurroundFooter, JoinBorder, LineColor, WhichPages, TL2BRBorder, TR2BLBorder, TL2BRColor, TR2BLColor, TL2BRStyle, TR2BLStyle, TL2BRWeight, TR2BLWeight, ForegroundRGB, BackgroundRGB, TopColorRGB, LeftColorRGB, BottomColorRGB, RightColorRGB, HorizColorRGB, VertColorRGB, TL2BRColorRGB, TR2BLColorRGB, LineColorRGB
wdDialogFormatBulletsAndNumbering (none)
wdDialogFormatCallout Type, Gap, Angle, Drop, Length, Border, AutoAttach, Accent
wdDialogFormatChangeCase Type
wdDialogFormatColumns Columns, ColumnNo, ColumnWidth, ColumnSpacing, EvenlySpaced, ApplyColsTo, ColLine, StartNewCol, FlowColumnsRtl
wdDialogFormatDefineStyleBorders ApplyTo, Shadow, TopBorder, LeftBorder, BottomBorder, RightBorder, HorizBorder, VertBorder, TopColor, LeftColor, BottomColor, RightColor, HorizColor, VertColor, FromText, Shading, Foreground, Background, Tab, FineShading, TopStyle, LeftStyle, BottomStyle, RightStyle, HorizStyle, VertStyle, TopWeight, LeftWeight, BottomWeight, RightWeight, HorizWeight, VertWeight, BorderObjectType, BorderArtWeight, BorderArt, FromTextTop, FromTextBottom, FromTextLeft, FromTextRight, OffsetFrom, InFront, SurroundHeader, SurroundFooter, JoinBorder, LineColor, WhichPages, TL2BRBorder, TR2BLBorder, TL2BRColor, TR2BLColor, TL2BRStyle, TR2BLStyle, TL2BRWeight, TR2BLWeight, ForegroundRGB, BackgroundRGB, TopColorRGB, LeftColorRGB, BottomColorRGB, RightColorRGB, HorizColorRGB, VertColorRGB, TL2BRColorRGB, TR2BLColorRGB, LineColorRGB
wdDialogFormatDefineStyleFont Points, Underline, Color, StrikeThrough, Superscript, Subscript, Hidden, SmallCaps, AllCaps, Spacing, Position, Kerning, KerningMin, Default, Tab, Font, Bold, Italic, DoubleStrikeThrough, Shadow, Outline, Emboss, Engrave, Scale, Animations, CharAccent, FontMajor, FontLowAnsi, FontHighAnsi, CharacterWidthGrid, ColorRGB, UnderlineColor, PointsBi, ColorBi, FontNameBi, BoldBi, ItalicBi, DiacColor
wdDialogFormatDefineStyleFrame Wrap, WidthRule, FixedWidth, HeightRule, FixedHeight, PositionHorz, PositionHorzRel, DistFromText, PositionVert, PositionVertRel, DistVertFromText, MoveWithText, LockAnchor, RemoveFrame
wdDialogFormatDefineStyleLang Language, CheckLanguage, Default, NoProof
wdDialogFormatDefineStylePara LeftIndent, RightIndent, Before, After, LineSpacingRule, LineSpacing, Alignment, WidowControl, KeepWithNext, KeepTogether, PageBreak, NoLineNum, DontHyphen, Tab, FirstIndent, OutlineLevel, Kinsoku, WordWrap, OverflowPunct, TopLinePunct, AutoSpaceDE, LineHeightGrid, AutoSpaceDN, CharAlign, CharacterUnitLeftIndent, AdjustRight, CharacterUnitFirstIndent, CharacterUnitRightIndent, LineUnitBefore, LineUnitAfter, NoSpaceBetweenParagraphsOfSameStyle, OrientationBi
wdDialogFormatDefineStyleTabs Position, DefTabs, Align, Leader, Set, Clear, ClearAll
wdDialogFormatDrawingObject Left, PositionHorzRel, Top, PositionVertRel, LockAnchor, FloatOverText, LayoutInCell, WrapSide, TopDistanceFromText, BottomDistanceFromText, LeftDistanceFromText, RightDistanceFromText, Wrap, WordWrap, AutoSize, HRWidthType, HRHeight, HRNoshade, HRAlign, Text, AllowOverlap, HorizRule
wdDialogFormatDropCap Position, Font, DropHeight, DistFromText
wdDialogFormatEncloseCharacters Style, Text, Enclosure
wdDialogFormatFont Points, Underline, Color, StrikeThrough, Superscript, Subscript, Hidden, SmallCaps, AllCaps, Spacing, Position, Kerning, KerningMin, Default, Tab, Font, Bold, Italic, DoubleStrikeThrough, Shadow, Outline, Emboss, Engrave, Scale, Animations, CharAccent, FontMajor, FontLowAnsi, FontHighAnsi, CharacterWidthGrid, ColorRGB, UnderlineColor, PointsBi, ColorBi, FontNameBi, BoldBi, ItalicBi, DiacColor
wdDialogFormatFrame Wrap, WidthRule, FixedWidth, HeightRule, FixedHeight, PositionHorz, PositionHorzRel, DistFromText, PositionVert, PositionVertRel, DistVertFromText, MoveWithText, LockAnchor, RemoveFrame
wdDialogFormatPageNumber ChapterNumber, NumRestart, NumFormat, StartingNum, Level, Separator, DoubleQuote, PgNumberingStyle
wdDialogFormatParagraph LeftIndent, RightIndent, Before, After, LineSpacingRule, LineSpacing, Alignment, WidowControl, KeepWithNext, KeepTogether, PageBreak, NoLineNum, DontHyphen, Tab, FirstIndent, OutlineLevel, Kinsoku, WordWrap, OverflowPunct, TopLinePunct, AutoSpaceDE, LineHeightGrid, AutoSpaceDN, CharAlign, CharacterUnitLeftIndent, AdjustRight, CharacterUnitFirstIndent, CharacterUnitRightIndent, LineUnitBefore, LineUnitAfter, NoSpaceBetweenParagraphsOfSameStyle, OrientationBi
wdDialogFormatPicture SetSize, CropLeft, CropRight, CropTop, CropBottom, ScaleX, ScaleY, SizeX, SizeY
wdDialogFormatRetAddrFonts Points, Underline, Color, StrikeThrough, Superscript, Subscript, Hidden, SmallCaps, AllCaps, Spacing, Position, Kerning, KerningMin, Default, Tab, Font, Bold, Italic, DoubleStrikeThrough, Shadow, Outline, Emboss, Engrave, Scale, Animations, CharAccent, FontMajor, FontLowAnsi, FontHighAnsi, CharacterWidthGrid, ColorRGB, UnderlineColor, PointsBi, ColorBi, FontNameBi, BoldBi, ItalicBi, DiacColor
wdDialogFormatSectionLayout SectionStart, VertAlign, Endnotes, LineNum, StartingNum, FromText, CountBy, NumMode, SectionType
wdDialogFormatStyle Name, Delete, Merge, NewName, BasedOn, NextStyle, Type, FileName, Source, AddToTemplate, Define, Rename, Apply, New, Link
wdDialogFormatStyleGallery Template, Preview
wdDialogFormatStylesCustom (none)
wdDialogFormatTabs Position, DefTabs, Align, Leader, Set, Clear, ClearAll
wdDialogFormatTheme (none)
wdDialogFormFieldHelp (none)
wdDialogFormFieldOptions Entry, Exit, Name, Enable, TextType, TextWidth, TextDefault, TextFormat, CheckSize, CheckWidth, CheckDefault, Type, OwnHelp, HelpText, OwnStat, StatText, Calculate
wdDialogFrameSetProperties (none)
wdDialogHelpAbout APPNAME, APPCOPYRIGHT, APPUSERNAME, APPORGANIZATION, APPSERIALNUMBER
wdDialogHelpWordPerfectHelp WPCommand, HelpText, DemoGuidance
wdDialogHelpWordPerfectHelpOptions CommandKeyHelp, DocNavKeys, MouseSimulation, DemoGuidance, DemoSpeed, HelpType
wdDialogHorizontalInVertical (none)
wdDialogIMESetDefault (none)
wdDialogInsertAddCaption Name
wdDialogInsertAutoCaption Clear, ClearAll, Object, Label, Position
wdDialogInsertBookmark Name, SortBy, Add, Delete, Goto, Hidden
wdDialogInsertBreak Type
wdDialogInsertCaption Label, TitleAutoText, Title, Delete, Position, AutoCaption, ExcludeLabel
wdDialogInsertCaptionNumbering Label, FormatNumber, ChapterNumber, Level, Separator, CapNumberingStyle
wdDialogInsertCrossReference ReferenceType, ReferenceKind, ReferenceItem, InsertAsHyperLink, InsertPosition, SeparateNumbers, SeparatorCharacters
wdDialogInsertDatabase Format, Style, LinkToSource, Connection, SQLStatement, SQLStatement1, PasswordDoc, PasswordDot, DataSource, From, To, IncludeFields, WritePasswordDoc, WritePasswordDot
wdDialogInsertDateTime DateTimePic, InsertAsField, DbCharField, DateLanguage, CalendarType
wdDialogInsertField Field
wdDialogInsertFile Name, Range, ConfirmConversions, Link, Attachment
wdDialogInsertFootnote Reference, NoteType, Symbol, FootNumberAs, EndNumberAs, FootnotesAt, EndnotesAt, FootNumberingStyle, EndNumberingStyle, FootStartingNum, FootRestartNum, EndStartingNum, EndRestartNum, ApplyPropsTo
wdDialogInsertFormField Entry, Exit, Name, Enable, TextType, TextWidth, TextDefault, TextFormat, CheckSize, CheckWidth, CheckDefault, Type, OwnHelp, HelpText, OwnStat, StatText, Calculate
wdDialogInsertHyperlink (none)
wdDialogInsertIndex Outline, Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel
wdDialogInsertIndexAndTables Outline, Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel
wdDialogInsertMergeField MergeField, WordField
wdDialogInsertNumber NumPic
wdDialogInsertObject IconNumber, FileName, Link, DisplayIcon, Tab, Class, IconFileName, Caption, Floating
wdDialogInsertPageNumbers Type, Position, FirstPage
wdDialogInsertPicture Name, LinkToFile, New, FloatOverText
wdDialogInsertSubdocument Name, ConfirmConversions, ReadOnly, LinkToSource, AddToMru, PasswordDoc, PasswordDot, Revert, WritePasswordDoc, WritePasswordDot, Connection, SQLStatement, SQLStatement1, Format, Encoding, Visible, OpenExclusive, OpenAndRepair, SubType, DocumentDirection, NoEncodingDialog, XMLTransform
wdDialogInsertSymbol Font, Tab, CharNum, CharNumLow, Unicode, Hint
wdDialogInsertTableOfAuthorities Outline, Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel
wdDialogInsertTableOfContents Outline, Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel
wdDialogInsertTableOfFigures Outline, Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel
wdDialogInsertWebComponent IconNumber, FileName, Link, DisplayIcon, Tab, Class, IconFileName, Caption, Floating
wdDialogLetterWizard SenderCity, DateFormat, IncludeHeaderFooter, LetterStyle, Letterhead, LetterheadLocation, LetterheadSize, RecipientName, RecipientAddress, Salutation, SalutationType, RecipientGender, RecipientReference, MailingInstructions, AttentionLine, LetterSubject, CCList, SenderName, ReturnAddress, Closing, SenderJobTitle, SenderCompany, SenderInitials, EnclosureNumber, PageDesign, InfoBlock, SenderGender, ReturnAddressSF, RecipientCode, SenderCode, SenderReference
wdDialogListCommands ListType
wdDialogMailMerge CheckErrors, Destination, MergeRecords, From, To, Suppression, MailMerge, QueryOptions, MailSubject, MailAsAttachment, MailAddress
wdDialogMailMergeCheck CheckErrors
wdDialogMailMergeCreateDataSource FileName, PasswordDoc, PasswordDot, HeaderRecord, MSQuery, SQLStatement, SQLStatement1, Connection, LinkToSource, WritePasswordDoc
wdDialogMailMergeCreateHeaderSource FileName, PasswordDoc, PasswordDot, HeaderRecord, MSQuery, SQLStatement, SQLStatement1, Connection, LinkToSource, WritePasswordDoc
wdDialogMailMergeFieldMapping (none)
wdDialogMailMergeFindRecipient (none)
wdDialogMailMergeFindRecord Find, Field
wdDialogMailMergeHelper Merge, Options
wdDialogMailMergeInsertAddressBlock (none)
wdDialogMailMergeInsertAsk Name, Prompt, DefaultBookmarkText, AskOnce
wdDialogMailMergeInsertFields (none)
wdDialogMailMergeInsertFillIn Prompt, DefaultFillInText, AskOnce
wdDialogMailMergeInsertGreetingLine (none)
wdDialogMailMergeInsertIf MergeField, Comparison, CompareTo, TrueAutoText, TrueText, FalseAutoText, FalseText
wdDialogMailMergeInsertNextIf MergeField, Comparison, CompareTo
wdDialogMailMergeInsertSet Name, ValueText, ValueAutoText
wdDialogMailMergeInsertSkipIf MergeField, Comparison, CompareTo
wdDialogMailMergeOpenDataSource Name, ConfirmConversions, ReadOnly, LinkToSource, AddToMru, PasswordDoc, PasswordDot, Revert, WritePasswordDoc, WritePasswordDot, Connection, SQLStatement, SQLStatement1, Format, Encoding, Visible, OpenExclusive, OpenAndRepair, SubType, DocumentDirection, NoEncodingDialog, XMLTransform
wdDialogMailMergeOpenHeaderSource Name, ConfirmConversions, ReadOnly, LinkToSource, AddToMru, PasswordDoc, PasswordDot, Revert, WritePasswordDoc, WritePasswordDot, Connection, SQLStatement, SQLStatement1, Format, Encoding, Visible, OpenExclusive, OpenAndRepair, SubType, DocumentDirection, NoEncodingDialog, XMLTransform
wdDialogMailMergeQueryOptions SQLStatement, SQLStatement1
wdDialogMailMergeRecipients (none)
wdDialogMailMergeSetDocumentType Type
wdDialogMailMergeUseAddressBook AddressBookType
wdDialogMarkCitation LongCitation, LongCitationAutoText, Category, ShortCitation, NextCitation, Mark, MarkAll
wdDialogMarkIndexEntry MarkAll, Entry, Range, Bold, Italic, CrossReference, EntryAutoText, CrossReferenceAutoText, Yomi
wdDialogMarkTableOfContentsEntry Entry, EntryAutoText, TableId, Level
wdDialogNewToolbar Name, Context
wdDialogNoteOptions FootnotesAt, FootNumberAs, FootStartingNum, FootRestartNum, EndnotesAt, EndNumberAs, EndStartingNum, EndRestartNum, FootNumberingStyle, EndNumberingStyle
wdDialogOrganizer Copy, Delete, Rename, Source, Destination, Name, NewName, Tab
wdDialogPhoneticGuide (none)
wdDialogReviewAfmtRevisions (none)
wdDialogSearch (none)
wdDialogShowRepairs Name, SortBy, Add, Delete, GoTo, Hidden
wdDialogTableAutoFormat HideAutoFit, Preview, Format, Borders, Shading, Font, Color, AutoFit, HeadingRows, FirstColumn, LastRow, LastColumn
wdDialogTableCellOptions (none)
wdDialogTableColumnWidth ColumnWidth, SpaceBetweenCols, PrevColumn, NextColumn, AutoFit, RulerStyle
wdDialogTableDeleteCells ShiftCells
wdDialogTableFormatCell Category
wdDialogTableFormula Formula, NumFormat
wdDialogTableInsertCells ShiftCells
wdDialogTableInsertRow NumRows
wdDialogTableInsertTable ConvertFrom, NumColumns, NumRows, InitialColWidth, Wizard, Format, Apply, AutoFit, SetDefault, Word8, Style
wdDialogTableOfCaptionsOptions (none)
wdDialogTableOfContentsOptions (none)
wdDialogTableProperties TableDirection
wdDialogTableRowHeight RulerStyle, LineSpacingRule, LineSpacing, LeftIndent, AllowRowSplit, Alignment, PrevRow, NextRow, TableDir
wdDialogTableSort DontSortHdr, FieldNum, Type, Order, FieldNum2, Type2, Order2, FieldNum3, Type3, Order3, Separator, SortColumn, CaseSensitive, SortBiDi, IgnoreHe, Diacritics, IgnoreThe, Kashida, Language, UsingNum, UsingNum2, UsingNum3
wdDialogTableSplitCells NumColumns, NumRows, MergeBeforeSplit
wdDialogTableTableOptions (none)
wdDialogTableToText ConvertTo, NestedTables
wdDialogTableWrapping PositionHorz, PositionHorzRel, PositionVert, PositionVertRel, TopDistanceFromText, BottomDistanceFromText, LeftDistanceFromText, RightDistanceFromText, MoveWithText, AllowOverlap,
wdDialogTCSCTranslator Direction, Varients, TranslateCommon
wdDialogTextToTable ConvertFrom, NumColumns, NumRows, InitialColWidth, Wizard, Format, Apply, AutoFit, SetDefault, Word8, Style
wdDialogToolsAcceptRejectChanges ShowMarks, HideMarks, Wrap, FindPrevious, FindNext, AcceptRevisions, RejectRevisions, AcceptAll, RejectAll
wdDialogToolsAdvancedSettings Application, Option, Setting, Delete, Set
wdDialogToolsAutoCorrect ShowFineTuner, CapTable, InWordMail, InitialCaps, SentenceCaps, Days, CapsLock, ReplaceText, Formatting, Replace, With, Add, Delete, SmartQuotes, CorrectHangulAndAlphabet, ConvBrackets, ConvQuotes, ConvPunct, ReplaceTextFromSpellingChecker
wdDialogToolsAutoCorrectExceptions Tab, Name, AutoAdd, Add, Delete
wdDialogToolsAutoManager Tab
wdDialogToolsAutoSummarize TextSize, Show, Update
wdDialogToolsBulletsNumbers Replace, Font, CharNum, Type, FormatOutline, AutoUpdate, FormatNumber, Punctuation, StartAt, Points, Hang, Indent, Remove, DoubleQuote
wdDialogToolsCompareDocuments CompareDestination, DetectFormatting, IgnoreCompareWarn, UseFormatFrom, AddToMru, Merge, FilterPrivacy, FilterDateAndTime, Name, CompareAuthor
wdDialogToolsCreateDirectory Directory
wdDialogToolsCreateEnvelope ExtractAddress, LabelListIndex, LabelIndex, LabelDotMatrix, LabelTray, LabelAcross, LabelDown, EnvAddress, EnvOmitReturn, EnvReturn, PrintBarCode, SingleLabel, LabelRow, LabelColumn, PrintEnvLabel, AddToDocument, EnvWidth, EnvHeight, EnvPaperSize, PrintFIMA, UseEnvFeeder, Tab, AddrAutoText, AddrText, AddrFromLeft, AddrFromTop, RetAddrFromLeft, RetAddrFromTop, LabelTopMargin, LabelSideMargin, LabelVertPitch, LabelHorPitch, LabelHeight, LabelWidth, CustomName, RetAddrText, EnvPaperName, DefaultFaceUp, DefaultOrientation, RetAddrAutoText, VerticalEnvelope, VerticalLabel, RecipientNamefromLeft, RecipientNamefromTop, RecipientPostalfromLeft, RecipientPostalfromTop, SenderNamefromLeft, SenderNamefromTop, SenderPostalfromLeft, SenderPostalfromTop, PrintEPostage, PrintEPostageLabel
wdDialogToolsCreateLabels ExtractAddress, LabelListIndex, LabelIndex, LabelDotMatrix, LabelTray, LabelAcross, LabelDown, EnvAddress, EnvOmitReturn, EnvReturn, PrintBarCode, SingleLabel, LabelRow, LabelColumn, PrintEnvLabel, AddToDocument, EnvWidth, EnvHeight, EnvPaperSize, PrintFIMA, UseEnvFeeder, Tab, AddrAutoText, AddrText, AddrFromLeft, AddrFromTop, RetAddrFromLeft, RetAddrFromTop, LabelTopMargin, LabelSideMargin, LabelVertPitch, LabelHorPitch, LabelHeight, LabelWidth, CustomName, RetAddrText, EnvPaperName, DefaultFaceUp, DefaultOrientation, RetAddrAutoText, VerticalEnvelope, VerticalLabel, RecipientNamefromLeft, RecipientNamefromTop, RecipientPostalfromLeft, RecipientPostalfromTop, SenderNamefromLeft, SenderNamefromTop, SenderPostalfromLeft, SenderPostalfromTop, PrintEPostage, PrintEPostageLabel
wdDialogToolsCustomize KeyCode, KeyCode2, MenuType, Position, AddAll, Category, Name, Menu, AddBelow, MenuText, Rename, Add, Remove, ResetAll, CommandValue, Context, Tab
wdDialogToolsCustomizeKeyboard KeyCode, KeyCode2, MenuType, Position, AddAll, Category, Name, Menu, AddBelow, MenuText, Rename, Add, Remove, ResetAll, CommandValue, Context, Tab
wdDialogToolsCustomizeMenuBar Context, Position, MenuType, MenuText, Menu, Add, Remove, Rename
wdDialogToolsCustomizeMenus KeyCode, KeyCode2, MenuType, Position, AddAll, Category, Name, Menu, AddBelow, MenuText, Rename, Add, Remove, ResetAll, CommandValue, Context, Tab
wdDialogToolsEnvelopesAndLabels ExtractAddress, LabelListIndex, LabelIndex, LabelDotMatrix, LabelTray, LabelAcross, LabelDown, EnvAddress, EnvOmitReturn, EnvReturn, PrintBarCode, SingleLabel, LabelRow, LabelColumn, PrintEnvLabel, AddToDocument, EnvWidth, EnvHeight, EnvPaperSize, PrintFIMA, UseEnvFeeder, Tab, AddrAutoText, AddrText, AddrFromLeft, AddrFromTop, RetAddrFromLeft, RetAddrFromTop, LabelTopMargin, LabelSideMargin, LabelVertPitch, LabelHorPitch, LabelHeight, LabelWidth, CustomName, RetAddrText, EnvPaperName, DefaultFaceUp, DefaultOrientation, RetAddrAutoText, VerticalEnvelope, VerticalLabel, RecipientNamefromLeft, RecipientNamefromTop, RecipientPostalfromLeft, RecipientPostalfromTop, SenderNamefromLeft, SenderNamefromTop, SenderPostalfromLeft, SenderPostalfromTop, PrintEPostage, PrintEPostageLabel
wdDialogToolsGrammarSettings Options
wdDialogToolsHangulHanjaConversion (none)
wdDialogToolsHighlightChanges MarkRevisions, ViewRevisions, PrintRevisions, AcceptAll, RejectAll
wdDialogToolsHyphenation AutoHyphenation, HyphenateCaps, HyphenationZone, LimitConsecutiveHyphens
wdDialogToolsLanguage Language, CheckLanguage, Default, NoProof
wdDialogToolsMacro Name, Run, Edit, Show, Delete, Rename, Description, NewName, SetDesc
wdDialogToolsMacroRecord (This dialog box cannot be called from a macro.)
wdDialogToolsManageFields FieldName, Add, Remove, Rename, NewName
wdDialogToolsMergeDocuments Name
wdDialogToolsOptions Tab
wdDialogToolsOptionsAutoFormat ApplyStylesLists, ApplyBulletedLists, ApplyStylesOtherParas, ReplaceQuotes, ReplaceOrdinals, ReplaceFractions, ReplaceSymbols, ReplacePlainTextEmphasis, ReplaceHyperlinks, PreserveStyles, PlainTextWordMail, ApplyFirstIndent, MatchParentheses, ReplaceDbDashes, ReplaceAutoSpaces
wdDialogToolsOptionsAutoFormatAsYouType cmntrInWordMail, ApplyStylesHeadings, ApplyStylesHeadings, ApplyBorders, ApplyTables, ApplyDates, ApplyBulletedLists, ApplyNumberedLists, ApplyFirstIndent, ApplyClosings, ReplaceQuotes, ReplaceOrdinals, ReplaceFractions, ReplaceSymbols, ReplacePlainTextEmphasis, ReplaceHyperlinks, MatchParentheses, ReplaceAutoSpaces, ReplaceDbDashes, FormatListItemBeginning, TabIndent, DefineStyles, InsertOvers, InsertClosings, AutoLetterWizard, ShowOptionsFor, ApplyStylesLists, ApplySkipList, ApplyStylesOtherParas, ReplaceBullets, AdjustParaMarks, AdjustTabsSpaces, AdjustEmptyParas, PreserveStyles
wdDialogToolsOptionsBidi DocViewDir, AddCtrlCopy, HebDoubleQuote, Numbers, Move, Sel, BiDirectional, ShowDiac, DiffDiacColor, Date, AdvanceHijri, MasterDocDir, OutlineDir, DiacriticColorVal, SequenceCheck, TypeNReplace
wdDialogToolsOptionsCompatibility Product, Default, NoTabHangIndent, NoSpaceRaiseLower, PrintColBlack, WrapTrailSpaces, NoColumnBalance, ConvMailMergeEsc, SuppressSpBfAfterPgBrk, SuppressTopSpacing, OrigWordTableRules, TransparentMetafiles, ShowBreaksInFrames, SwapBordersFacingPages, LeaveBackslashAlone, ExpandShiftReturn, DontULTrailSpace, DontBalanceSbDbWidth, SuppressTopSpacingMac5, SpacingInWholePoints, PrintBodyTextBeforeHeader, NoLeading, NoSpaceForUL, MWSmallCaps, NoExtraLineSpacing, TruncateFontHeight, SubFontBySize, UsePrinterMetrics, WW6BorderRules, ExactOnTop, SuppressBottomSpacing, WPSpaceWidth, WPJustification, LineWrapLikeWord6, SpLayoutLikeWW8, FtnLayoutLikeWW8, DontUseHTMLParagraphAutoSpacing, DontAdjustLineHeightInTable, ForgetLastTabAlignment, UseAutospaceForFullWidthAlpha, AlignTablesRowByRow, LayoutRawTableWidth, LayoutTableRowsApart, UseWord97LineBreakingRules, DontBreakWrappedTables, DontSnapToGridInCell, DontAllowFieldEndSelect, ApplyBreakingRules, DontWrapTextWithPunct, DontUseAsianBreakRules, UseWord2002TableStyleRules, GrowAutofit
wdDialogToolsOptionsEdit ReplaceSelection, DragAndDrop, AutoWordSelection, InsForPaste, Overtype, SmartCursoring, SmartCutPaste, AllowAccentedUppercase, PictureEditor, TabIndent, BsParaAlign, InlineConversion, IMELosingFocus, AllowClickAndTypeMouse, ClickAndTypeParagraphStyle, AutoKeyBi, PictureWrapType, SmartParaSelection, HypCtrlClickFollow, PasteRecovery, PromptUpdateStyle, FormatScanning, ShowFormatError
wdDialogToolsOptionsEditCopyPaste SmartSentenceWordSpacing, SmartParaPaste, SmartTablePaste, SmartStylePaste, FormatPowerpointPaste, FormatExcelPaste, PasteMergeLists, CopyPasteDefaultOptions
wdDialogToolsOptionsFileLocations Path, Setting
wdDialogToolsOptionsFuzzy FuzzyCase, FuzzyByte, FuzzyHira, FuzzySmKana, FuzzyMinus, FuzzyRepSymbol, FuzzyKanji, FuzzyOldKana, FuzzyLongVowel, FuzzyDZ, FuzzyBV, FuzzyTC, FuzzyHF, FuzzyZJ, FuzzyAY, FuzzyKIKU, FuzzyPunct, FuzzySpace
wdDialogToolsOptionsGeneral Pagination, WPHelp, WPDocNavKeys, BlueScreen, ErrorBeeps, Effects3d, UpdateLinks, SendMailAttach, RecentFiles, RecentFileCount, Units, ButtonFieldClicks, ShortMenuNames, RTFInClipboard, ConfirmConversions, TipWizardActive, AnimatedCursors, VirusProtection, SeparateFont, InterpretHIANSIToDBC, ExitWithRestoreSession, AsianText, PixelsInDialogs, UseCharacterUnit, BackgroundOpen, AutoCreateNewDrawings, AllowReadingMode
wdDialogToolsOptionsPrint Draft, Reverse, UpdateFields, Summary, ShowCodes, Annotations, ShowHidden, EnvFeederInstalled, WidowControl, DfltTrueType, UpdateLinks, Background, DrawingObjects, FormsData, DefaultTray, PSOverText, MapPaperSize, FractionalWidths, PrOrder1, PrOrder2, PrintXmlTags, Backgrounds
wdDialogToolsOptionsSave CreateBackup, FastSaves, SummaryPrompt, GlobalDotPrompt, NativePictureFormat, EmbedFonts, FormsData, AutoSave, SaveInterval, Password, WritePassword, RecommendReadOnly, SubsetFonts, BackgroundSave, DefaultSaveFormat, AddCtrlSave, DoNotEmbed, LocalNetworkFile, WordCompatibilityList, EmbedSmartTags, SmartTagXML, EmbedLinguisticData
wdDialogToolsOptionsSecurity WarnMarkup, StoreRsid, ShowMarkupOpenSave
wdDialogToolsOptionsSmartTag LabelSmartTags, ShowSmartTagOOUI
wdDialogToolsOptionsSpellingAndGrammar AlwaysSuggest, SuggestFromMainDictOnly, IgnoreAllCaps, IgnoreMixedDigits, ResetIgnoreAll, Type, CustomDict1, CustomDict2, CustomDict3, CustomDict4, CustomDict5, CustomDict6, CustomDict7, CustomDict8, CustomDict9, CustomDict10, AutomaticSpellChecking, FilenamesEmailAliases, UserDict1, AutomaticGrammarChecking, ForegroundGrammar, ShowStatistics, Options, RecheckDocument, IgnoreAuxFind, IgnoreMissDictSearch, HideGrammarErrors, CheckSpelling, GrLidUI, SpLidUI, DictLang1, DictLang2, DictLang3, DictLang4, DictLang5, DictLang6, DictLang7, DictLang8, DictLang9, DictLang10, HideSpellingErrors, HebSpellStart, InitialAlefHamza, FinalYaa, GermanPostReformSpell, AraSpeller, ProcessCompoundNoun
wdDialogToolsOptionsTrackChanges InsertedTextMark, InsertedTextColor, DeletedTextMark, DeletedTextColor, RevisedLinesMark, RevisedLinesColor, HighlightColor, RevisedPropertiesMark, RevisedPropertiesColor
wdDialogToolsOptionsTypography KerningPairs, Justification, PunctLevel, FollowingPunct, LeadingPunct, ApplyToTemplate, JapaneseKinsokuStrict, FarEastLineBreakLanguage
wdDialogToolsOptionsUserInfo Name, Initials, Address
wdDialogToolsOptionsView DraftFont, WrapToWindow, PicturePlaceHolders, FieldCodes, BookMarks, FieldShading, StatusBar, HScroll, VScroll, StyleAreaWidth, Tabs, Spaces, Paras, Hyphens, Hidden, ShowAll, Drawings, Anchors, TextBoundaries, VRuler, Highlight, ShowAnimation, ScrnTp, LeftScroll, RRuler, OptionalBreak, EnlargeFontsLessThan, BrowseToWindow, PageBoundaries, WindowsInTaskbar, SmartTags, ShowAtStartup, Backgrounds
wdDialogToolsProtectDocument DocumentPassword, NoReset, Type, UseDRM
wdDialogToolsProtectSection Protect, Section
wdDialogToolsRevisions MarkRevisions, ViewRevisions, PrintRevisions, AcceptAll, RejectAll
wdDialogToolsSpellingAndGrammar SuggestionListBox, ForegroundGrammar
wdDialogToolsTemplates Store, Template, LinkStyles
wdDialogToolsThesaurus (none)
wdDialogToolsUnprotectDocument DocumentPassword
wdDialogToolsWordCount CountFootnotes, Pages, Words, Characters, DBCs, SBCs, CharactersIncludingSpaces, Paragraphs, Lines
wdDialogTwoLinesInOne (none)
wdDialogUpdateTOC (none)
wdDialogViewZoom AutoFit, TwoPages, FullPage, NumColumns, NumRows, ZoomPercent, TextFit
wdDialogWebOptions (none)
wdDialogWindowActivate Window

            In the MWEP only one of the dialogs from the list above was used. The following sets the printer (in the current version of MWEP this has been hidden). This functionality was added into Office 2003:

With Dialogs(wdDialogFilePrintSetup)
.Printer = "GoBinder"
.DoNotSetAsSysDefault = True
.Execute
End With
Application.ActiveDocument.PrintOut

Accessing the Windows API in VBA

            Another way to access built-in dialog boxes and other procedures, use the Windows Application Programming Interface, or API. The API allows Word and Access to interacting with Windows using VBA. The API is a complex set of functions which allows the VBA programmer to gain access to many of the functions that windows uses internally, such as printing, to access Windows Dialog boxes, to access the registry, and even to shut down Windows. The Windows API is made up of a whole set of implementation specific DLL hosted functions, which reside in three system DLL files, which are located on every computer that is using the Windows operating system:

  • User32.dll - Handles the user interface

  • Kernel32.dll - Working with files and your computers memory

  • Gdi32.dll - Graphical commands

            Microsoft bundled many more DLLs which are accessible through the Windows Operating System, however, they are separated into numerous other system DLL files, which is out of the scope of this discussion. Because of the multi-threaded mature of the Windows operating system, several programs can access the Windows API simultaneously.

            Windows API functions are very fast and powerful, but actually calling them up and executing them can be difficult and time consuming. You should only use Windows API functions if the task you are trying to implement is not available as a regular VBA function or statement.

            There are literally thousands of API functions available throughout the numerous Windows API DLL libraries. Almost everything that Windows can do is listed as an API function. A further, more in-depth discussion on "Accessing DLLs and the Windows API" (http://msdn.microsoft.com/en-us/library/aa261278(VS.60).aspx) and "The Windows API and Other Dynamic-Link Libraries" (http://msdn.microsoft.com/en-us/library/aa141322(office.10).aspx)

            The following API call was placed in the splash screen to bring up the windows szDialogTitle which allows the user to search for the needed back-end folder. Notice that it passes on the value "C:\" to the variable szDialogTitle:

(borrowed from the MVP site http://www.hammerdata.com/Newsgrp/api/api0002.htm)

Call AutoMacros.BrowseFolder(szDialogTitle = "C:\")

     The following declaration needs to be made to establish the BrowseFolder function or class (in the AutoMacros module):

Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
"SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long

Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long

            Now here is the actual dialog box code (also in the AutoMacros module):

Public Function BrowseFolder(szDialogTitle As String) As String
Dim X As Long, bi As BROWSEINFO, dwIList As Long
Dim szPath As String, wPos As Integer, XX As String

With bi
.hOwner = hWndAccessApp
.lpszTitle = szDialogTitle
.ulFlags = BIF_RETURNONLYFSDIRS
End With

dwIList = SHBrowseForFolder(bi)
szPath = Space$(512)
X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)

If X Then
wPos = InStr(szPath, Chr(0))
BrowseFolder = Left$(szPath, wPos - 1)
Else
BrowseFolder = vbNullString
End If
frmSplashscreen.TextBox2 = szPath
yy = frmSplashscreen.TextBox2 & "\zfilemds_Scheduler.mdb"
frmSplashscreen.TextBox2 = yy
conDBpath2 = yy
Select Case XX
Case "welcome"
Case "handouts"
Call ListBoxFill1
Case "workups"
Call ListBoxFill2
Call ListBoxFill2
End Select
End Function