I'd try the module in a new .mdb file. Every once and a while I have a code module that won't run a standard VBA library (Vbe6.dll) function, and its usually the case that my Access file is corrupt and not the library file.
If you continue to have problems with VBA functions, try browsing to the Vbe6.dll in the References dialog to rebuild the path information:
C:\Program Files\Common Files\Microsoft Shared\Vba\Vba6\Vbe6.dll
Otherwise, here's how you replace a corrupt Vbe6.dll file per MS:
Rename and Reinstall the Vbe6.dll File
For a corrupted, missing, or wrong version of the Vbe6.dll file, follow these steps.
NOTE: You need your Office CD-ROM to complete this task.
1. Quit all currently open programs.
2. Start an MS-DOS prompt in a window by doing one of the following:
⢠Microsoft Windows 95 or Windows 98:
Click Start, point to Programs, and then click MS-DOS Prompt.
⢠Microsoft Windows Millennium Edition (Me):
Click Start, point to Programs, point to Accessories, and then click MS-DOS Prompt.
⢠Microsoft Windows NT 4.0:
Click Start, point to Programs, and then click Command Prompt.
⢠Microsoft Windows 2000 or Microsoft Windows XP:
Click Start, point to Programs, point to Accessories, and then click Command Prompt.
3. To change the directory to the location of the Vbe6.dll file, type one of the following (including the quotation marks), and then press ENTER:
CD "C:\Program Files\Common Files\Microsoft Shared\Vba\Vba6"
-or-
CD progra~1\Common~1\Micros~1\Vba\Vba6
NOTE: This is the default directory for the Vbe6.dll file. If you installed Microsoft Office into another drive or directory, you must type its path.
4. To unregister the Vbe6.dll file, type the following.
In Windows 95, Windows 98, or Windows Me, type:
C:\Windows\System\REGSVR32 /U VBE6.DLL
In Windows NT 4.0, Windows 2000, or Windows XP, type:
REGSVR32 /U VBE6.DLL
-or-
C:\Winnt\System32\REGSVR32 /U VBE6.DLL
NOTE: This is the default directory for the Windows System directory. If you installed Windows into another directory, you must type its path.
5. In the MS-DOS prompt window, rename Vbe.dll to Vbe.old by typing the following and then pressing ENTER:
rename vbe6.dll vbe6.old
6. Quit the MS-DOS prompt window. To do this, do one of the following: ⢠Type Exit at the command prompt, and then press ENTER. -or-
⢠Click Close (the X in the upper-right corner of the window).
7. Start Microsoft Access.
8. On the Tools menu, point to Macro, and then click VBA Editor.
The Windows Installer detects that the Vbe6.dll file is missing on the system, installs the file from the Office CD, and registers it again.
|