PDA

View Full Version : Reference in VBA



ezywrap05
04-06-2006, 09:23 AM
I've been trying to find this answer for a day now and have run into a wall. How do you make a reference to Microsoft Internet Controls in code rather than going thru Tool -> Reference ?

Thank You

TonyJollans
04-06-2006, 09:45 AM
Hi ezywrap05,

Welcome to VBAX!

The statement you need isThisDocument.VBProject.References.AddFromFile "C:\WINDOWS\SYSTEM32\SHDOCVW.DLL"but in recent versions of Office (XP, 2003) you will need to have "Trust Access to Visual Basic Project" checked under Tools > Macro > Security > Trusted Publishers tab.

ezywrap05
04-06-2006, 01:40 PM
Project.ThisSession.VBProject.References.AddFromFile "C:\WINNT\SYSTEM32\SHDOCVW.DLL"

Worked great. Thank you for the help.

TonyJollans
04-06-2006, 04:01 PM
You didn't specify which app so my default was Word. Glad you managed to adjust it for Outlook.