Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
PJ PJ is offline
external usenet poster
 
Posts: 112
Default Check to see if reference library is enabled

I was given a macro that requires "Microsoft Scripting Runtime" be enabled in
order to work properly. Is there a way I can add a check to see if the user
running the macro has it enabled? I want to add a prompt with instructions
if they do not but I need to know how to verify first.
  #2   Report Post  
Posted to microsoft.public.excel.programming
r r is offline
external usenet poster
 
Posts: 125
Default Check to see if reference library is enabled

Private Sub AddRefToScripting()
'______________________________________________
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯
'Di Roberto Mensa nick r
'______________________________________________
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯
'controlla i riferimenti
'se manca il riferimento a Scripting lo aggiunge

With Application.VBE
If Verifica_Riferimento(.ActiveVBProject, "Scripting") = False Then
.ActiveVBProject.References.AddFromGuid _
"{420B2830-E718-11CF-893D-00A0C9054228}", 1, 0
End If
End With
End Sub

Public Function Verifica_Riferimento( _
ByRef oProject As Object, _
ByVal sRef As String) As Boolean
'______________________________________________
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯
'Di Roberto Mensa nick r
'______________________________________________
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯
'Verifica se un riferimento è caricato su
'oProject
'sRef il nome del riferimento nel codice
Dim v
For Each v In oProject.References
If UCase(v.Name) = UCase(sRef) Then
Verifica_Riferimento = True
Exit Function
End If
Next
End Function

regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html


"PJ" wrote:

I was given a macro that requires "Microsoft Scripting Runtime" be enabled in
order to work properly. Is there a way I can add a check to see if the user
running the macro has it enabled? I want to add a prompt with instructions
if they do not but I need to know how to verify first.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Check to see if reference library is enabled

I wouldn't do this. Instead have the author of the macro (or you???) change it
so that you use late binding instead of early binding.

Some references:

http://support.microsoft.com/default...b;EN-US;244167
INFO: Writing Automation Clients for Multiple Office Versions

http://support.microsoft.com/default...b;en-us;245115
INFO: Using Early Binding and Late Binding in Automation

http://support.microsoft.com/default...b;en-us;247579
INFO: Use DISPID Binding to Automate Office Applications Whenever Possible

and Dick Kusleika has a web page at:
http://www.dicks-clicks.com/excel/olBinding.htm
that explains this with Outlook

==========
I'd develop with the references so that I could get the benefit of the
intellisense and autocomplete within the VBE, but then change to late binding
before sharing with others.



PJ wrote:

I was given a macro that requires "Microsoft Scripting Runtime" be enabled in
order to work properly. Is there a way I can add a check to see if the user
running the macro has it enabled? I want to add a prompt with instructions
if they do not but I need to know how to verify first.


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Check to see if reference library is enabled

Place a check within the loop...

Dim ref As Variant
For Each ref In Application.VBE.ActiveVBProject.References
MsgBox ref.Name
Next

If this post helps click Yes
---------------
Jacob Skaria


"PJ" wrote:

I was given a macro that requires "Microsoft Scripting Runtime" be enabled in
order to work properly. Is there a way I can add a check to see if the user
running the macro has it enabled? I want to add a prompt with instructions
if they do not but I need to know how to verify first.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Check If The User Has Macros Enabled When The Workbook Opens [email protected] Excel Programming 7 December 12th 08 08:27 PM
Check for the Newest Available Library [email protected] Excel Programming 1 April 7th 08 07:20 PM
setting up library check out KJP692 Excel Programming 3 June 18th 07 05:48 PM
library check in and out bookworm Excel Discussion (Misc queries) 1 December 18th 04 12:45 AM
Reference Library - Missing Library in a lower version. luvgreen Excel Programming 1 October 7th 04 02:08 AM


All times are GMT +1. The time now is 03:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"