Advertisement
Guest User

Untitled

a guest
Feb 16th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpDest As Any, lpSource As Any, ByVal cBytes&)
  4.  
  5. Dim Ribbon As IRibbonUI
  6.  
  7. Sub rb_onLoad(rib As IRibbonUI)
  8.   Set Ribbon = rib
  9.   Sheet1.Range("A1").Value = ObjPtr(rib)
  10. End Sub
  11.  
  12. Function GetRibbon() As IRibbonUI
  13.     If Ribbon Is Nothing Then
  14.         Dim ribbonPointer As Long
  15.         On Error GoTo errorhandler
  16.         ribbonPointer = Sheet1.Range("A1").Value
  17.         Call CopyMemory(Ribbon, ribbonPointer, 4)
  18.         On Error GoTo 0
  19.     End If
  20.  
  21.     Set GetRibbon = Ribbon
  22. errorhandler:
  23. End Function
  24.  
  25. Sub Update()
  26.     GetRibbon().Invalidate
  27. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement