Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How do I test in VBA to see if a particual DLL exists in my references? I
want to test to see if the RegExp library exists and if so I want to check it off. If it does not exist I want o generate an error message prompting the user that the file is not available in the libraries. On a side note, I am assuming that the library should be available. Why would it not be? Is there any reason that xl97 upward would not have this? And if it is not available, what are the users options (assuming this may be driven by version of Excel). For example, say the user had it but accidentally deleted it. What would they need to do to restore it? Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi xlmonkey
If you open the vb editor window and go to tools and then references you will see the referenced dlls in the dialog that comes up. Depending on what you are doing you will have to know which will be ticked in the list. You cannot get to this option in debug mode. you can check for any file at a known path through vba Sub FileExists() Dim fso Dim file As String file = "C:\Test.xls" ' change to match the file w/Path Set fso = CreateObject("Scripting.FileSystemObject") If Not fso.FileExists(file) Then MsgBox file & " was not located.", vbInformation, "File Not Found" Else MsgBox file & " has been located.", vbInformation, "File Found" End If End Sub You could maybe use a shell command through vba to register or unregister dlls as librarys through vba. I have done it with regsrv for windows files before but only through start... run... dialogue in the windows start bar. Search google forr info on this. Hope that helps Rob "ExcelMonkey" wrote in message ... How do I test in VBA to see if a particual DLL exists in my references? I want to test to see if the RegExp library exists and if so I want to check it off. If it does not exist I want o generate an error message prompting the user that the file is not available in the libraries. On a side note, I am assuming that the library should be available. Why would it not be? Is there any reason that xl97 upward would not have this? And if it is not available, what are the users options (assuming this may be driven by version of Excel). For example, say the user had it but accidentally deleted it. What would they need to do to restore it? Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Give this a whirl
Dim ref As Object Dim fRef As Boolean fRef = False For Each ref In ThisWorkbook.VBProject.References If ref.Name = "VBScript_RegExp_55" Then Debug.Print ref.Name ThisWorkbook.VBProject.References.Remove ref fRef = True End If Next If Not fRef Then MsgBox "No ref set" -- HTH RP (remove nothere from the email address if mailing direct) "ExcelMonkey" wrote in message ... How do I test in VBA to see if a particual DLL exists in my references? I want to test to see if the RegExp library exists and if so I want to check it off. If it does not exist I want o generate an error message prompting the user that the file is not available in the libraries. On a side note, I am assuming that the library should be available. Why would it not be? Is there any reason that xl97 upward would not have this? And if it is not available, what are the users options (assuming this may be driven by version of Excel). For example, say the user had it but accidentally deleted it. What would they need to do to restore it? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Test if file exists | Excel Discussion (Misc queries) | |||
Test if Sheet Exists - Tom Ogilvy | Excel Programming | |||
Test for Worksheet Exists | Excel Programming | |||
Test if folder exists, create if it doesn't? | Excel Programming | |||
Test if a folder exists | Excel Programming |