Consulting

Results 1 to 5 of 5

Thread: What reference do I add to access .net objects from Excel VBA

  1. #1
    VBAX Newbie
    Joined
    Nov 2012
    Posts
    2
    Location

    What reference do I add to access .net objects from Excel VBA

    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)

  2. #2
    AFAIK you cannot add direct references to the .NET library from VBA. Period.
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  3. #3
    Perhaps this windows API call can help you:

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

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  4. #4
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    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.
    Be as you wish to seem

  5. #5
    VBAX Newbie
    Joined
    Nov 2012
    Posts
    2
    Location
    Quote Originally Posted by Jan Karel Pieterse
    AFAIK you cannot add direct references to the .NET library from VBA. Period.
    Well! that's a drag for sure

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •