but I am already stuck in creating buttons in VBE tool.
Code: Select all
'Put the buttons in the VBE Tools menu
Public Sub Initialize()
Dim Btn As CommandBarButton, Obj As Object, cBtn As clsBtn
Dim i As Long, j As Long
Terminate
Set Col = New Collection
For j = 1 To 2
On Error GoTo err_h
Set Obj = Choose(j, Application.VBE.CommandBars.FindControl(ID:=30007), Application.VBE.CommandBars("Code Window"))
With Obj
For i = 1 To 4
Set Btn = .Controls.Add(msoControlButton)
With Btn
.Caption = Choose(i, "Convert selected code as &HTML", "Convert current procedure as &HTML", "Convert selected code as &BB code", "Convert current procedure as &BB code")
.BeginGroup = Choose(i, True, False, True, False)
.Tag = AppCode
.OnAction = ThisWorkbook.Name & "!Create" & IIf(i <= 2, "HTML", "BB")
If i Mod 2 = 0 Then
.Parameter = 1
Else
.Parameter = 0
End If
.FaceId = Choose(i, 2478, 0, 1557, 0)
.Style = msoButtonIconAndCaption
End With
Set cBtn = New clsBtn
Set cBtn.BtnEvents = Application.VBE.Events.CommandBarEvents(Btn)
Col.Add cBtn
Next i
End With
Next j
Exit Sub
err_h:
If Err.Number = 1004 Then
MsgBox "Access to the VB project is not trusted", vbCritical, AppName
ThisWorkbook.Close False
Else
MsgBox Err.Number & ": " & Err.Description
Resume Next
End If
End Sub
In this code, I am not understanding what
Code: Select all
.OnAction = ThisWorkbook.Name & "!Create" & IIf(i <= 2, "HTML", "BB")
Doesn't .OnAction just looks for a sub in the procedure and runs it?
To Administrator: If you need this BB/HTML convertor, PM me and I'll send the code or the whole add-in to you :)