PDA

View Full Version : What reference do I add to access .net objects from Excel VBA



gbritton
11-20-2012, 01:54 PM
I have a need to use certain methods in the System.IO Namespace from an Excel VBA macro (Specifically, methods and properties in the Path class). What I can't figure out, is what reference to add to be able to use this class.

Can anyone point me in the right direction? Note that I am interested in this question for two reasons:

1. How to do this specifically (that is, how use Path.GetRandomFileName, e.g. from VBA)
2. How to do this generally (to be able to reference other .Net objects)

Jan Karel Pieterse
11-21-2012, 03:17 AM
AFAIK you cannot add direct references to the .NET library from VBA. Period.

Jan Karel Pieterse
11-21-2012, 03:21 AM
Perhaps this windows API call can help you:

http://support.microsoft.com/kb/195763

Aflatoon
11-21-2012, 04:49 AM
It would be mscorlib.dll but you can't use System.IO.Path from VBA as far as I know, unlike some of the .Net objects.

gbritton
11-21-2012, 07:38 AM
AFAIK you cannot add direct references to the .NET library from VBA. Period.

Well! that's a drag for sure