ThisMacroStorage.cls 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. VERSION 1.0 CLASS
  2. BEGIN
  3. MultiUse = -1 'True
  4. END
  5. Attribute VB_Name = "ThisMacroStorage"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = False
  8. Attribute VB_PredeclaredId = True
  9. Attribute VB_Exposed = True
  10. Private Sub GlobalMacroStorage_start()
  11. On Error GoTo ErrorHandler
  12. Dim creatTool As Boolean: creatTool = True
  13. StartButton = Val(GetSetting("LYVBA", "Settings", "StartButton", "0"))
  14. If StartButton = 1 Then creatTool = False
  15. If creatTool Then
  16. SaveSetting "LYVBA", "Settings", "StartButton", "1"
  17. AddPluginCommand "LYVBA.CorelVBA.Start", "CorelVBA.Start", "CorelVBA.Start"
  18. AddPluginCommand "LYVBA.CorelVBA.Start_Dimension", "CorelVBA.Start_Dimension", "CorelVBA.Start_Dimension"
  19. AddPluginCommand "LinesTool.lines.start", "lines.start", "lines.start"
  20. AddPluginCommand "ZeroBase.Hello_VBA.run", "Hello_VBA.run", "Hello_VBA.run"
  21. For Each Item In CommandBars
  22. If Item.name = "CorelVBA" Then
  23. creatTool = False
  24. End If
  25. Next
  26. If creatTool Then CommandBars.Add "CorelVBA"
  27. With CommandBars.Item("CorelVBA")
  28. .Visible = True
  29. Set ctl = .Controls.AddCustomButton(cdrCmdCategoryMacros, "LYVBA.CorelVBA.Start")
  30. ' ctl.SetIcon2 ("guid://a8e62a7a-d5d2-4a05-8d5d-e07d6bd21993")
  31. Set ctl2 = .Controls.AddCustomButton(cdrCmdCategoryMacros, "LYVBA.CorelVBA.Start_Dimension")
  32. Set ctl3 = .Controls.AddCustomButton(cdrCmdCategoryMacros, "LinesTool.lines.start")
  33. Set ctl4 = .Controls.AddCustomButton(cdrCmdCategoryMacros, "ZeroBase.Hello_VBA.run")
  34. End With
  35. End If
  36. refresh_Icon
  37. ErrorHandler:
  38. End Sub
  39. Private Function refresh_Icon()
  40. With CommandBars.Item("CorelVBA")
  41. .Controls.Item(1).SetIcon2 ("guid://a8e62a7a-d5d2-4a05-8d5d-e07d6bd21993")
  42. .Controls.Item(2).SetIcon2 ("guid://b4b9632a-248b-4d80-a62d-88804e50a955")
  43. .Controls.Item(3).SetIcon2 ("guid://d2fdc0d9-09f8-4948-944c-4297395c05b7")
  44. .Controls.Item(4).SetIcon2 ("guid://1a0b1202-d0ef-4fe7-8a95-ac7617b30703")
  45. End With
  46. End Function