How Do You Stop Annoying Excel Message Boxes?
Colin Hayes wrote...
....
4 I put a hyperlink address into A3 , within the RunEXE area , and
made sure the cell reference in 'Place in this document' is A3. Save
and reopen. Tested it - gave run time error pointing to this line in
the debugger :
Shell Target.Range.Text, vbNormalFocus
This indicates that the cell doesn't evaluate to something Shell can
launch as a program.
I didn't test this thoroughly. While Windows's own Run dialog can run
urls directly, it appears VBA's Shell statement can't. To accommodate
the Shell statement's limitations, change the event handler to
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim cmd As String
cmd = Environ("COMSPEC") & " /c start "
With Me.Parent.Names("RunRng")
If Not Intersect(Target.Range, .RefersToRange) Is Nothing Then _
Shell cmd & Target.Range.Text, vbHide
End With
End Sub
For urls to .EXE files, this will display a dialog asking if you want
to run or save the file, which puts you back in the same place you
started at, though with a different dialog. I didn't test for that
before now either.
You could use the freely available utility wget to download .EXE files
pointed to by urls into the TEMP directory, run the downloaded .EXE
files, then delete them. Messy, but it works.
|