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.