hi, i tried the following, but no luck. not a critical item, but am interested if there is an answer in that.
'Sub Test1()
ActiveWorkbook.FollowHyperlink ActiveCell.HYPERLINKS(1).Address 'activecell, line err: subscript out of range
'ActiveWorkbook.FollowHyperlink Worksheets("Sheet1").RANGE("A1").HYPERLINKS(1).Address
'end sub
if a matter of hyperlink uses a friendly name problem.. checking, not work either. else old examples of follow hyperlink might do that.. was:
'ActiveWorkbook.FollowHyperlink ActiveCell '(after remove friendly name from hyperlink, this works)
i had help before, receiving a macro for splitting a unique hyperlink friendly name out. i wondered if there wasn't something more general so to escape identifying the friendly name.. but then again, that option was conveniently included in the user defined
function? i can inlcude that here, but note:
NOTE: might just need original request for left click.
OTHER VB that works well, splits friendly name out. (even so, looking for a single click vb..)
Sub goFHL(strF As String, strDL As String) 'GOFHLXXX gofhlxxx 255 chars AS: goFHL ActiveCell.Formula, ",friendlyname"
Dim V As Variant 'follow HYPERLINK AS: (left of friendly name): goFHL ActiveCell.Formula, ",IF("
'enter quotes as string ANS: either double up on quotes:
'goFHL ActiveCell.Formula, ",""SAM""" 'for: ,"SAM" OR USE: & CHR(34) &
'goFHL ActiveCell.Formula, "," & CHR(34) & "SAM" & CHR(34)
If InStr(1, strF, "HYPERLINK") = 0 Or InStr(1, strF, strDL) = 0 Then
Application.EnableEvents = True: Exit Sub 'EVENTS
End If
V = split(strF, strDL)
On Error Resume Next
ActiveWorkbook.FollowHyperlink Application.Evaluate(Replace(V(0), "HYPERLINK(", ""))
Application.EnableEvents = True 'EVENTS
'gofhl() GOFHL()
End Sub
==========
OTHER: i found examples of below, but as yet unable to apply. not sure what to put where.
'orig:
'Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
'Const MOUSEEVENTF_RIGHTDOWN = &H8
'Const MOUSEEVENTF_RIGHTUP = &H10
'Public Sub RightDown()
'mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
'mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
'trying:
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Public Sub goClick()
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
OTHER:
sites that seem to have a similar examples, still did not focus on the one item, perform a click and/or how to apply it? will check later.
http://www.myengineeringworld.net/2011/11/handle-other-applications-through-excel.html
http://excelhelphq.com/how-to-move-and-click-the-mouse-in-vba/
a google might be
https://encrypted.google.com/search?complete=0&num=100&hl=en&safe=off&q=vba+xp+excel+left+mouse+click+%22Private+Declare+Sub+mouse\_event+Lib%22
http://www.ozgrid.com/forum/showthread.php?t=188084
with these examples, if possible, would like a simple call to click the selected cell (but not going to exclude examples for selecting other locations/ remotely) for something merely like:
call goClick 'to left click the current selection