Solved is it possible to alter an hyperlink in the backstage part of the Ribbon? (1 Viewer)

smig

Registered User.
Local time
Tomorrow, 01:28
Joined
Nov 25, 2009
Messages
2,209
I want to customize a Hyperlink I already have in the BackStage part of the Ribbon.

I use getLabel/setLabel, getStyle/setStyle.... to change things in VBA
I'm trying to do the same with getTarget/setTarget to alter the target of an Hyperlink, with no success :(
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:28
Joined
May 7, 2009
Messages
19,237
you can do it just invalidate the ribbon obj
 

smig

Registered User.
Local time
Tomorrow, 01:28
Joined
Nov 25, 2009
Messages
2,209
you can do it just invalidate the ribbon obj

I can't make it work :(
Can't find what am I doing wrong here

It won't crash nor raise an error, I just get no link working

Here how it looks in the ribbon XML
Code:
<hyperlink id="hlnkAbout1" getLabel="Ribbon_GetLabel" getTarget="Ribbon_GetTarget"/>

Here are the functions
Code:
Public Sub Ribbon_GetTarget(control As IRibbonControl, target)

' On Error GoTo ExitHere


Select Case control.Id
    Case "grpAbout1"
        target = str_hlnkAbout1_Target
    Case "grpAbout2"
        target = str_hlnkAbout2_Target
    Case "grpAbout3"
        target = str_hlnkAbout3_Target
    Case Else
End Select


ExitHere:
    Exit Sub

errHere:
    Call ErrorHandling("mdl_Ribbons", "Ribbon_GetTarget", Err, Err.Description)
    Resume ExitHere

End Sub

Public Sub Ribbon_SetTarget(strCntrl As String, strTarget As String)

' On Error GoTo ExitHere


Select Case strCntrl
    Case "grpAbout1"
        str_hlnkAbout1_Target = strTarget
    Case "grpAbout2"
        str_hlnkAbout2_Target = strTarget
    Case "grpAbout3"
        str_hlnkAbout3_Target = strTarget
    Case Else
End Select

objRibbonName.InvalidateControl (strCntrl)


ExitHere:
    Exit Sub

errHere:
    Call ErrorHandling("mdl_Ribbons", "Ribbon_SetTarget", Err, Err.Description)
    Resume ExitHere

End Sub

And here is the code calling the function
Code:
str_hlnkAbout1_Target = "https://" & pbWhatsappLink
str_hlnkAbout2_Target = "mailto:" & pbInfoEmail
str_hlnkAbout3_Target = "https://" & pbHTTP

Call Ribbon_SetTarget("hlnkAbout1", str_hlnkAbout1_Target)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:28
Joined
May 7, 2009
Messages
19,237
check again you ribbon xml.
your hyperlink id is hlnkAbout1, it is not found in your select case
in your Ribbon_GetTarget callback.

also make these variables Public:
str_hlnkAbout1_Target
str_hlnkAbout2_Target
str_hlnkAbout3_Target
 

Users who are viewing this thread

Top Bottom