> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# WizHook: A Hidden Access Object With Intriguing Potential
- URL: https://nolongerset.com/wizhook/
- Published: 2022-10-26T03:46:14.000Z
- Updated: 2026-05-08T12:53:54.000Z
- Description: Font-aware AutoFit of text and combo boxes, auto-bracketing of illegal field names, sorting an array of strings...the possibilities are finite!
- Author: Mike Wolfe
- Tags: Hidden Features, WizHook, #Import 2026-05-20 02:59

> I ran across this bit of very-hidden quite arcane VBA UI wizardry, and it needs to see the light of day.

That's how Mark Burns–no stranger to the far reaches of the Microsoft Access community–began a recent email he sent me. And it got my attention. After all, what feature could be (1) so hidden that Mark had never seen it before and (2) so intriguing that he felt compelled to share it with me?

The wizardry to which Mark referred is the hidden `WizHook` object.

## What is WizHook?

WizHook is a hidden property of the `Access.Application` object.

To discover it for yourself:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/10/image-52.png)

1. Open the Object Browser (\[F2\]) in the VBIDE
2. Right-click in the header section to open the context menu
3. Check the box to "Show Hidden Members"
4. Choose "Access" from the library dropdown
5. Click on the "Application" class
6. Click on the "WizHook" member
7. Click on the "WizHook" link to open the WizHook class

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/10/image-53.png)

## Microsoft Access WizHook Reference

The best English-language documentation I have come across is JasonM's PDF, ***[Microsoft Access WizHook Reference](https://assets.nolongerset.com/2022/WizHook.pdf)***.

Jason's documentation starts off with the following disclaimer:

> I always noticed \[the WizHook object\] had some interesting sounding procedure names, but there's almost no reference to it on the internet. This is my attempt at documenting it the best I can. Please understand the vast majority of this is the result of trial and error, so if you find a mistake or have a better interpretation of what's happening, please email me so I can update this document.

## Additional Documentation

WizHook documentation is notoriously sparse. 

Outside of JasonM's PDF, some of the best documentation for the WizHook object lives on foreign language forums.

Here are the most useful forum posts I could find:

- [German](https://www.team-moeller.de/?Tipps%5Fund%5FTricks:Wizhook-Objekt) (Thomas Moeller)
- [Spanish](http://www.mvp-access.es/juanmafan/wizhook/wizhook.htm) (Juan M. Afán deRibera)
- [French](https://cafeine.developpez.com/access/tutoriel/autoextensible/) (Charles A. Feine)
- [English](https://www.accessforums.net/showthread.php?t=75572&page=5) (Colin Riddington, et al.)

## The Secret WizHook Handshake

Oh, I almost forgot the most important part of all!

Before you can call most of the methods of the WizHook object, you have to unlock it by assigning the [magic number](https://en.wikipedia.org/wiki/Magic%5Fnumber%5F%28programming%29) `51488399` to its `Key` property:

```vba
WizHook.Key = 51488399   'It's undocumented magic, just go with it.
```

## Sample Function

I will be writing additional [articles covering the WizHook object](https://nolongerset.com/tag/wizhook/), but for now, I'll repost this handy sample [from the MSDN forums](https://social.msdn.microsoft.com/Forums/en-US/2727e4a4-57a3-4e4d-a20a-314464579ad3/how-to-calculate-the-width-of-a-access-form-textbox-pending-on-font-and-length-of-characters-string?forum=isvvba) to whet your appetite:

```vba
Public Function GetTextLength(pCtrl As Control, ByVal str As String, _
        Optional ByVal Height As Boolean = False)
    Dim lx As Long, ly As Long
    ' Initialize WizHook
    WizHook.Key = 51488399
    ' Populate the variables lx and ly with the width and height of the
    ' string in twips, according to the font settings of the control
    WizHook.TwipsFromFont pCtrl.FontName, pCtrl.FontSize, pCtrl.FontWeight, _
                          pCtrl.FontItalic, pCtrl.FontUnderline, 0, _
                          str, 0, lx, ly
    If Not Height Then
        GetTextLength = lx
    Else
        GetTextLength = ly
    End If
End Function
```

The function can be used like this to AutoFit an Access form/report control:

```vba
Public Sub AutoFit(ctl As Control)
    Dim lngWidth As Long
    lngWidth = GetTextLength(ctl, ctl.Value)
    ctl.Width = lngWidth + 40   '40: horizontal buffer; may need adjusting
End Sub
```

*Image by [Franck Barske](https://pixabay.com/users/barskefranck-6433778/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=4510395) from [Pixabay](https://pixabay.com//?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=4510395)*

***UPDATE*** *\[2022-10-28\]: Added German-language link to Thomas Moeller's website.*