Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How To Check If The User Has Macros Enabled When The Workbook Opens | Excel Programming | |||
Check for the Newest Available Library | Excel Programming | |||
setting up library check out | Excel Programming | |||
library check in and out | Excel Discussion (Misc queries) | |||
Reference Library - Missing Library in a lower version. | Excel Programming |