Version 2.6                   First Published 5 Nov 2022                   Last Updated 27 Nov 2022                         Difficulty level :   Moderate

Section Links :
            What is WizHook?             WizHook Key             Example App             WizHook Object Summary             Downloads
            YouTube Video                  Acknowledgements & Useful Links             Conclusions


1.   What is Wizhook?                                                                                                                   Return To Top

      Wizhook is a hidden Access object that was quietly added in Access 2000. Additional features were gradually expanded over the next few versions of Access.
      See the article by Thomas Möller : Overview of WizHook functions by Access Version

      WizHook was originally created so that Access Wizards could use or hook onto its functionality.

      Access contains many built-in hidden functions - most are undocumented. It is always possible that they could be removed when new versions of Access are released.

      Over the years, I have used a number of these hidden functions including LoadFromText, SaveAsText, Wizhook and several others.
      Most of the ones I've tried are both functional and very useful.

      One exception is the hidden ISAMStats function which is still listed but stopped working in Access 2013. See my article Optimising Queries

      To view hidden functions in the VBE right click in the object browser and select Show Hidden Members

WizhookLibrary
      The screenshot above shows some members of the hidden Wizhook object.
      There are 71 object members in all. The vast majority are functions but there are also a few subs and 3 properties

      NOTE:
      You can use any of these functions even when they are hidden

      The purpose of this article and the accompanying example app is to provide a detailed reference giving details of all the object members and how these are used.

      However, due to the lack of official documentation, there are still some items whose functionality remains unknown



2.   Wizhook Key                                                                                                                           Return To Top

      Wizhook has one additional feature that is, as far as I know, unique.
      For almost all WizHook members, you MUST supply the Wizhook key in your code or it won't work

      Code:

WizHook.Key = 51488399



      The key can be set:
      a)   immediately after Access starts so you do not need to worry about the key when using the methods of the WizHook object.
      b)   directly before using the WizHook object where it is needed. In my opinion, doing this makes the code clearer and easier to understand.



3.   Example App:                                                                                                                         Return To Top

      The main form lists all Wizhook members alphabetically

MainForm
      The three buttons at the top link to:

      a)   a form giving the WizHook.Key value

WizhookKey
      b)   the WizHook website run by Thomas Möller

WizhookHelp
      c)   the WizHook reference article on my website (this page!!!)

WizhookRef
      All buttons are colour coded to indicate their status
      Click any button to view details for each WizHook member including example code and a link to the specific object help article by Thomas Möller

      The functions vary in their usefulness:
      Several are very useful and in some cases are the best or only method available of achieving a specific outcome e.g. TwipsFromFont
      Many others work though some of them have very limited usage. In some cases, better methods are now available e.g. using File System Object (FSO).
      A few members are only for use with Access Data Pages - an Access feature deprecated in 2007.
      Finally, the purpose of some functions has still not been determined after over 20 years!

      Here are a selection of some of the more useful WizHook functions:

      In ALL cases, make sure you include all specified arguments even where these are not needed (leave them blank)

a)   TwipsFromFont

      This gets the width / height of selected text in twips (one twentieth of imperial point size) where 1440 twips = 1 inch or 567 twips = 1 cm

TwipsFromFont
      Updated values after changing the font name, size, weight and style:

TwipsFromFont2
      The syntax for TwipsFromFont is:

      Function TwipsFromFont(FontName As String, Size As Long, Weight As Long, _
            Italic As Boolean, Underline As Boolean, Cch As Long, Caption As String, _
            MaxWidthCch As Long, dx As Long, dy As Long) As Boolean



      CODE:

WizHook.Key = 51488399

If WizHook.TwipsFromFont(strFontName, lngSSize, lngSwidth, fItalic, fUnderline, lngCch, strCaption, _
      lngMaxWidthCch, lngWidth, lngHeight) = True Then
      WizHook.WizMsgBox "The specified text (with the selected font attributes) has the following dimensions : " & _
            "@ Width: " & lngWidth & _
      " Height: " & lngHeight & "@", "TwipsFromFont", vbInformation, 0, ""
Else
      MsgBox "Calculation failed", vbExclamation, "TwipsFromFont"
End If



      NOTE:
      Contrary to documentation, the output for dx & dy are Integer values NOT Long

      This means large font sizes can give negative values for lngWidth if output > 32767
      e.g. using Wide Latin font of 100pt+

      This is fixed as follows:
      IIf(lngWidth<1,(32768-Abs(lngWidth))+32768,lngWidth)

      lngHeight shouldn't ever exceed integer limit for valid font sizes from 1 to 127 pt

      MODIFIED CODE:

WizHook.Key = 51488399

If WizHook.TwipsFromFont(strFontName, lngSSize, lngSwidth, fItalic, fUnderline, lngCch, strCaption, _
      lngMaxWidthCch, lngWidth, lngHeight) = True Then
      WizHook.WizMsgBox "The specified text (with the selected font attributes) has the following dimensions : " & _
            "@ Width: " & IIf(lngWidth < 1, (32768 - Abs(lngWidth)) + 32768, lngWidth) & vbCrLf & _
      " Height: " & lngHeight & "@", "TwipsFromFont", vbInformation, 0, ""
Else
      MsgBox "Calculation failed", vbExclamation, "TwipsFromFont"
End If



      Possible uses for TwipsFromFont include:

        i)   Adjusting the width / height of a textbox or combo box to ensure that all text is displayed

AutofitText
            See example code by Hans Vogelaar to achieve this effect:
            How to calculate the width of a access form textbox using VBA depending on font and length of characters string

            An example app is available (see below)

            A similar method can be used to reduce the font size to ensure all text fits in a fixed width text box

      ii)   'Selecting' objects in a listbox using a mouse move event. See my article: Accurately Move Forms and Controls
            TwipsFromFont is used to determine the listbox row under the mouse cursor

            For example, the contact details form is automatically updated as the mouse moves over the listbox

MoveForm4-Listbox1
            In this example, the image is updated as the mouse moves over each listbox item

MoveForm3-Listbox2
b)   SortStringArray

      This sorts an array of text strings alphabetically. The WizHook key is not needed here

SortStringArray
      CODE:

'SortStringArray syntax
'Sub SortStringArray(Array() As String)

' Declare variables
Dim strArray(4) As String
Dim intI As Integer

' The WizHook Key is NOT required for this procedure.

For intI = 1 To 5
      If Len(Trim$(Nz(Me("txtText" & intI), ""))) = 0 Then
            MsgBox "Cannot sort with a blank entry", vbCritical, "Blank not allowed:"
            Exit Sub
      Else
            strArray(intI - 1) = Me("txtText" & intI)
      End If
Next intI

'Original - unsorted
WizHook.WizMsgBox "Unsorted:" & _
      "@" & strArray(0) & " / " & strArray(1) & " / " & strArray(2) & " / " & strArray(3) & " / " & strArray(4) & " @" & _
      " ", "SortStringArray", vbExclamation, 0, ""

'Sort
WizHook.SortStringArray strArray()
WizHook.WizMsgBox "Sorted:" & _
      "@" & strArray(0) & " / " & strArray(1) & " / " & strArray(2) & " / " & strArray(3) & " / " & strArray(4) & " @" & _
      " ", "SortStringArray", vbInformation, 0, ""



c)   OfficeAddInDir

      This gets the folder used for Office add-ins

OfficeAddInDir
      CODE:

'OfficeAddInDir syntax
'Function OfficeAddInDir() As String

Dim strPath As String

WizHook.Key = 51488399
strPath = WizHook.OfficeAddInDir

If WizHook.WizMsgBox("The Office add-ins folder is:" & _
      "@" & strPath & " @" & _
      "Click OK to open the folder now" & vbCrLf & _
     "Otherwise click CANCEL", "Office add-ins folder", vbInformation + vbOKCancel, 0, "") = vbOK Then
            'open add-ins folder
            Application.FollowHyperlink strPath
End If



d)   AccessUserDataDir

      This gets the user's default Access data folder

UserDataDir
      CODE:

'AccessUserDataDir syntax
'Function AccessUserDataDir() As String

Dim strPath As String

WizHook.Key = 51488399
strPath = WizHook.AccessUserDataDir

If WizHook.WizMsgBox("The default Access data folder is: " & _
      "@" & strPath & " @" & _
      "Click OK to open the folder now" & vbCrLf & _
     "Otherwise click CANCEL", "User data folder", vbInformation + vbOKCancel, 0, "") = vbOK Then
            'open user data folder
            Application.FollowHyperlink strPath
End If



e)   WizMsgBox

      This is used to build a message box with optional bold text for the first section
      It also provides an easy method of linking to a help file

WizMsgBox
      CODE:

'WizMsgBox syntax
'Function WizMsgBox(bstrText As String, bstrCaption As String, wStyle As Long, idHelpID As Long, bstrHelpFileName As String) As Long

' Declare variables
Dim strTitle As String
Dim strNote As String
Dim lngStyle As Long
Dim lngHelpID As Long
Dim strHelpFile As String

strTitle = Nz(Me.txtTitle, "")
strNote = Nz(Me.txtMessage, "")
lngStyle = Nz(Me.cboStyle, 0) Or Nz(Me.cboIcon, 0)
lngHelpID = Nz(Me.cboHelpID, 0)
strHelpFile = Nz(Me.txtHelpFileName, "")

WizHook.Key = 51488399
WizHook.WizMsgBox strNote, strTitle, lngStyle, lngHelpID, strHelpFile



      NOTE:
      •   You MUST include all WizMsgBox arguments even where a help button isn't required. This works:

WizhookRiddle
            However, omitting the last two arguments causes an error

WizhookRiddleError
      •   In my opinion, a better way of achieving similar results is by using a Formatted Message Box instead.
            This has an improved layout and does not require Wizhook.

FormattedMsgBoxRiddle
f)   GetColumns

      This is used to get a list of field names for a selected table or query

GetColumns
      CODE:

'GetColumns syntax
'Function GetColumns(bstrBase As String) As String

Dim strObject As String, strType As String

WizHook.Key = 51488399

WizHook.WizMsgBox strType & " Name : " & strObject & " " & vbCrLf & vbCrLf & _
      "Field Names : " & _
      "@" & Replace(WizHook.GetColumns(strObject), ";", vbCrLf) & " @", _
      "GetColumns", vbInformation, 0, ""





4.   WizHook Object Summary                                                                                                     Return To Top

      This is a brief summary of all Wizhook functions. For further details, see the example app and the links below


Name Object Type Works? Comments
AccessUserDataDir Function Yes Returns the path to the default Access data folder
AccessWizFilePath Function Yes Returns the path to the various Access wizard database files
AdpUIDPwd Function Yes Determines whether it is an ADP file and outputs the user ID and password of the active user (access security system)
AnalyzeQuery Function ? As used by the Peformance Analysis Wizard - analyzes query design - but ALWAYS returns no results
AnalyzeTable Function Yes As used by the Peformance Analysis Wizard - analyzes table design
ArgsOfActid Function Yes Returns the number of arguments for an action ID (used to create macros)
BracketString Function Yes Encloses the individual parts of an expression in square [ ] brackets
CacheStatus Sub No Not yet documented. Related to Access cache option?
CloseCurrentDatabase Function Yes Closes the current database object - NOT the database itself.
HOWEVER, if run from the Immediate window, all VBE windows and the database are closed
CreateDataPageControl Function Yes Creates a new control on a data access page. Access 2000/2002/2003 ONLY
CurrentLangID Function Yes Determines the ID of the currently used language e.g. 2057 for English (Great Britain)
DbcVbProject Property Yes Returns the name of the current VB project
EmbedFileOnDataPage Function No Not yet documented. Access Data Pages ONLY?
EnglishPictToLocal Function Yes Translates Format property expressions into the current Office language
ExecuteTempImexSpec Function No Not yet documented. Related to import/export specifications?
FCacheStatus Function ? Boolean value. Always returns False regardless of cache settings used
FCreateNameMap Function No Not yet documented. Related to navigation pane groups?
FGetMSDE Function ? Possibly related to Microsoft SQL Server 2000 Desktop Engine (MSDE)
Boolean value: Returns True / False depending on the input value specified
FileExists Function Yes Checks if a file exists
FirstDbcDataObject Function Yes Provides information about the first data object in the database
FIsFEWch Function ? Purpose unknown. Boolean value: Returns True if input value >912 ; otherwise False
FIsPublishedXasTable Function No Not yet documented
FIsValidXasObjectName Function Yes Boolean value: Checks whether the entered object name is valid
True if OK, False if special characters used e.g. %, *, |
FIsXasDb Function No Function not yet documented. Boolean value: Always returns False in my tests
FullPath Function Yes Converts a relative path specification to an absolute path
GetAccWizRCPath Function Yes Gets full path of file ACWIZRC.dll (Microsoft Access Wizard International DLL file)
GetAdeRegistryPath Function Yes Returns the (incomplete) registry path for the Access Database Engine
GetColumns Function Yes Returns a list of fields in a table or query
GetCurrentView Function ? Should return which view a table is displayed in BUT doesn't work correctly
ALWAYS returns same value whether table in design or datasheet view
GetDisabledExtensions Function Yes Displays a list of disabled extensions . . . BUT disabled WHERE?
GetFileName Function Yes Displays the Office file picker dialog (without requiring a reference to the Office library)
GetFileName2 Function Yes Displays the Office file picker dialog (without requiring a reference to the Office library)
Almost identical to the GetFileName function
GetFileOdso Function Yes Open a selection dialog for a data source and returns the DSN connection string
GetImexTblName Function No Not yet documented. Related to import/export specifications?
GetInfoForColumns Function Yes Returns a list of fields and attributes in a table or query
GetLinkedListProperty Function No Not yet documented. Related to linked tables?
GetObjPubOption Function ? Purpose not known. Return Values: 0 if iObjTyp<>0; 1 if TablesAsClient= False; 2 if fTablesAsClient= True
GetScriptString Function Yes Returns the values from the various columns of a macro and its arguments
GetWizGlob Function ? Purpose not known. Return values: True where input = 2 or 3; False if input = 0, 1 or 4 ; otherwise Null
GlobalProcExists Function Yes Checks whether a procedure with specified name exists in a standard module. Can be Private or Public ; Sub or Function.
HideDates Function ? Not yet documented. Boolean value: ALWAYS returns True in my tests
IsMatchToDbcConnectString Property Yes Boolean value: Checks whether the passed string matches the connection string of the database
IsMemberSafe Function Yes Restricts output = True ONLY where input = -1. Return values: True where input = -1; otherwise False
IsValidIdent Function Yes Boolean value: Checks whether the name of a variable is valid / conforms to the rules
Key Property Yes Property that activates the WizHook object. WizHook.Key = 51488399 for code to run
KeyboardLangID Function Yes Determines the current language ID set for the keyboard e.g. 2057 for English (Great Britain)
KnownWizLeaks Sub No Not yet documented
LoadImexSpecSolution Sub No Not yet documented. Related to import/export specifications?
LoadResourceLibrary Function ? Appears to be related to reference libraries. Returns a unique value for each library?
LocalFont Function Yes Determines the default character set used by Access e.g. Tahoma
NameFromActid Function Yes Returns the name for an Action ID (used to create macros)
ObjTypOfRecordSource Function Yes Determines the type of a data source.
Integer value: 0=SQL expression; 1 = Table; 2 = Query; 0 = object does not exist
OfficeAddInDir Function Yes This returns the path to the Access add-ins folder
OpenEmScript Function No Not yet documented
OpenPictureFile Function Yes Opens a file selection dialog titled "Insert Picture" for standard graphic file types.
The full path of the selected image is displayed in a message box
OpenScript Function Yes Opens a macro and returns a reference to it
ReportLeaksToFile Function No Not yet documented
SaveObject Function Yes Stores a database object - for use with Data Access Pages. Access 2000/2002/2003 ONLY
DoCmd.SaveObject has same result!
SaveScriptString Function Yes Writes a value to a column of a macro
SetDefaultSpecName Sub No Not yet documented
SetDpBlockKeyInput Sub Yes Blocks keystrokes for a data access page. Access 2000/2002/2003 ONLY
SetVbaPassword Function Yes Sets a new VBA password. Cannot be used to change an existing VBA password
SetWizGlob Sub No Not yet documented
SortStringArray Function Yes Sorts an array of text boxes alphabetically. WizHook key NOT needed
SplitPath Sub Yes Splits a file path into its components: drive, directory, file name and extension
TableFieldHasUniqueIndex Function Yes Checks whether a column in a table has a unique index
TranslateExpression Function Yes? Meant to convert a passed string to a valid expression but unreliable in my tests. Fails if string contains spaces
ParseFlags=16 encloses string in [ ], 32 adds a leading ", 1 or 64 crashes Access.
TranslateFlags value appears to have no effect
TwipsFromFont Function Yes Gets the height and width of the specified text in twips. 1440 twips = 1 inch; 567 twips = 1 cm
WizCopyCmdbars Function Yes Imports the custom command bars from the specified database. Apparently also exports custom commands bars to the specified database
WizHelp Function Yes Opens a specified CHM help file. If left blank, it opens the in-app help task pane in recent versions of Access
WizMsgBox Function Yes Display a formatted message box with optional help button





5.   Downloads                                                                                                                               Return To Top

      The example app is based on work by two other developers:
      a)   Thomas Möller - created the original version in German for his WizHook article back in 2007. This included details for 57 objects
      b)   Peter Cole - translated this into English and added Access themes

      I have made the following changes:
      •   provided additional info for each object together with details (where known) of the functionality for another 14 WizHook object members.
      •   added automatic form resizing, help text and made significant use of the WizMsgBox function


      Version History:
      •   v2.4     04/11/2022 - Initial Release
      •   v2.5     21/11/2022 - Added help text for each Wizhook member; fixed resizing issue for high-resolution monitors
      •   v2.6     25/11/2022 - Made caption help text optional; updated TwipsFromFont form; bug fixes


      Click to download:
            Wizhook_En_v2.6.accdb      approx 4.1 MB (zipped)

            Example app showing how the width of a textbox can be automatically adjusted to fit the text using TwipsFromFont:
            AutofitText.accdb      approx 0.5 MB (zipped)
            For more info, see my article Autofit or Zoom? Match Text to Form Control



6. YouTube Videos                                                                                                                           Return To Top

      I have created a YouTube video for my Isladogs on Access channel as an introduction to Wizhook and a few of its simpler functions.

      This is now available at: Wizhook: A Hidden (But Very Useful) Access Object or you can click below:

       

      I have also created another YouTube video on the same channel channel demonstrating the use of the WizHook TwipsFromFont function.

      This is now available at: Using WizHook - Twips From Font function or you can click below:

       

      Further videos on WizHook are also planned

      If you subscribe to my Isladogs on Access channel on YouTube, you will be notified whenever new videos are released.



7.   Acknowledgements & Useful Links                                                                                       Return To Top

      Isaac Newton famously wrote: "If I have seen further than others, it is by standing on the shoulders of giants."

      I would like to thank the following people upon whose work I have built for this article:

      Skrol - who first provided me with the WizHook key back in 2017. He is the author of the excellent free Access add-in V-Tools
      The V-Tools deep search feature is particularly useful.

      Jason M - for his article written back in 2003 http://pointltd.com/Downloads/Files/WizHook.pdf   (in English)

      Juan de Ribera - for his article also written in 2003 http://www.mvp-access.es/juanmafan/wizhook/wizhook.htm   (in Spanish)

      Thomas Möller - for providing by far the most detailed and authoritative article on the subject WizHook Object   (in German but auto-translated by most browsers)

      Peter Cole - for translating much of the example app into English and adding themes. See his website Theme My Database

      In addition, I am pleased to see that Mike Wolfe has recently started writing a series of articles on Wizhook for his NoLongerSet website.
      There are currently 5 articles on WizHook. These can be found at https://nolongerset.com/tag/wizhook/

      UPDATE 9 Nov 2022

      In the few days since I first released this article, the following related items have been published:

      a) An article by Mike Wolfe linking back to this article: WizHook References

      b) a YouTube video (in Spanish) by new Access MVP Juanjo Luna discussing a few WizHook functions: WizHook (Clase Oculta en MS Access)

           



8.   Conclusions                                                                                                                             Return To Top

      Although this article has been compiled over a period of time, it is still incomplete as not all WizHook members have yet been documented.
      Please use the contact form to let me know if there are any errors or omissions.

      I would be very grateful for any additional information about the WizHook object members - especially those whose functionality is still unknown

      Please also use the contact form to let me know whether you found this article/example app useful or if you have any questions.



Colin Riddington                 Mendip Data Systems                 Last Updated 27 Nov 2022



Return to Access Articles Page Return to Top