Actual code for perusal
This commit is contained in:
698
Code/ButtonCalls.bas
Normal file
698
Code/ButtonCalls.bas
Normal file
@@ -0,0 +1,698 @@
|
||||
Attribute VB_Name = "ButtonCalls"
|
||||
|
||||
Public SelectionShapeID As String
|
||||
|
||||
Public SelectionShapeSlideIndex As Long
|
||||
|
||||
Public SelectionShapeIDNumber As Long
|
||||
|
||||
Public PrimaryShape As shape
|
||||
|
||||
Public PrimaryHeight As Long
|
||||
|
||||
Public PrimaryWidth As Long
|
||||
|
||||
Dim CusDataLabel As New CustomDataLabel
|
||||
|
||||
'To determine if selection is a valid shape
|
||||
|
||||
Public Function GetShape() As shape
|
||||
|
||||
|
||||
|
||||
Dim shp
|
||||
|
||||
Dim Selected_Shape
|
||||
|
||||
|
||||
|
||||
'Determine Which Shape is Active
|
||||
|
||||
If True Then 'ActiveWindow.Selection.Type = ppSelectionShapes Then
|
||||
|
||||
'Loop in case multiples shapes selected
|
||||
|
||||
For Each shp In ActiveWindow.Selection.ShapeRange
|
||||
|
||||
'ActiveShape is first shape selected
|
||||
|
||||
SelectionShapeSlideIndex = Application.ActiveWindow.View.Slide.SlideIndex
|
||||
|
||||
SelectionShapeID = shp.Name
|
||||
|
||||
SelectionShapeIDNumber = shp.Id
|
||||
|
||||
Exit For
|
||||
|
||||
Next shp
|
||||
|
||||
Else
|
||||
|
||||
MsgBox "Only shapes are supported.", vbCritical, "Sorry"
|
||||
|
||||
End
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Set GetShape = shp
|
||||
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Public Sub Error_On_Apply()
|
||||
|
||||
|
||||
|
||||
MsgBox "The secondary shape you have chosen has a property that cannot be applied from the primary shape. Some restrictions " & _
|
||||
|
||||
"apply for VBA where attributes cannot be copied as well. If anything has been applied incorrectly, undo it. " & vbNewLine & vbNewLine & _
|
||||
|
||||
"The current primary shape information has also been wiped. Please re-select it.", vbCritical, "Note"
|
||||
|
||||
|
||||
|
||||
End
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Public Sub NoPrimaryShape()
|
||||
|
||||
|
||||
|
||||
MsgBox "It seems like you haven't chosen a primary shape. Please do so. If this is in error, please file an issue " & _
|
||||
|
||||
"on Github with an example where it can be reproduced.", vbExclamation, "Note"
|
||||
|
||||
|
||||
|
||||
End
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
'Callback for LockShape onAction
|
||||
|
||||
Sub LockShape(control As IRibbonControl)
|
||||
|
||||
|
||||
|
||||
Set PrimaryShape = GetShape
|
||||
|
||||
|
||||
|
||||
Exit Sub
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
'Callback for SetHeight onAction
|
||||
|
||||
Sub SetHeight(control As IRibbonControl)
|
||||
|
||||
|
||||
|
||||
On Error GoTo ErrHand
|
||||
|
||||
|
||||
|
||||
If Not PrimaryShape Is Nothing Then
|
||||
|
||||
With GetShape
|
||||
|
||||
.Height = PrimaryShape.Height
|
||||
|
||||
End With
|
||||
|
||||
Else
|
||||
|
||||
NoPrimaryShape
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Exit Sub
|
||||
|
||||
|
||||
|
||||
ErrHand:
|
||||
|
||||
Error_On_Apply
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
'Callback for SetWidth onAction
|
||||
|
||||
Sub SetWidth(control As IRibbonControl)
|
||||
|
||||
|
||||
|
||||
On Error GoTo ErrHand
|
||||
|
||||
|
||||
|
||||
With GetShape
|
||||
|
||||
.Width = PrimaryShape.Width
|
||||
|
||||
End With
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Exit Sub
|
||||
|
||||
|
||||
|
||||
ErrHand:
|
||||
|
||||
Error_On_Apply
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
'Callback for SetDimesion onAction
|
||||
|
||||
Sub SetDimension(control As IRibbonControl)
|
||||
|
||||
|
||||
|
||||
On Error GoTo ErrHand
|
||||
|
||||
|
||||
|
||||
If Not PrimaryShape Is Nothing Then
|
||||
|
||||
With GetShape
|
||||
|
||||
.Width = PrimaryShape.Width
|
||||
|
||||
.Height = PrimaryShape.Height
|
||||
|
||||
End With
|
||||
|
||||
Else
|
||||
|
||||
NoPrimaryShape
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Exit Sub
|
||||
|
||||
|
||||
|
||||
ErrHand:
|
||||
|
||||
Error_On_Apply
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
'Callback for SetPosition onAction
|
||||
|
||||
Sub SetPosition(control As IRibbonControl)
|
||||
|
||||
|
||||
|
||||
On Error GoTo ErrHand
|
||||
|
||||
|
||||
|
||||
If Not PrimaryShape Is Nothing Then
|
||||
|
||||
With GetShape
|
||||
|
||||
.Left = PrimaryShape.Left
|
||||
|
||||
.Top = PrimaryShape.Top
|
||||
|
||||
End With
|
||||
|
||||
Else
|
||||
|
||||
NoPrimaryShape
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Exit Sub
|
||||
|
||||
|
||||
|
||||
ErrHand:
|
||||
|
||||
Error_On_Apply
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
'Callback for SetColour onAction
|
||||
|
||||
Sub SetFill(control As IRibbonControl)
|
||||
|
||||
|
||||
|
||||
On Error GoTo ErrHand
|
||||
|
||||
|
||||
|
||||
If Not PrimaryShape Is Nothing Then
|
||||
|
||||
With GetShape
|
||||
|
||||
.Fill.BackColor.RGB = PrimaryShape.Fill.BackColor.RGB
|
||||
|
||||
.Fill.ForeColor.RGB = PrimaryShape.Fill.ForeColor.RGB
|
||||
|
||||
.Fill.Transparency = PrimaryShape.Fill.Transparency
|
||||
|
||||
If PrimaryShape.Fill.GradientColorType = msoGradientOneColor Or PrimaryShape.Fill.GradientColorType = msoGradientMultiColor Then
|
||||
|
||||
.Fill.OneColorGradient PrimaryShape.Fill.GradientStyle, _
|
||||
|
||||
PrimaryShape.Fill.GradientVariant, _
|
||||
|
||||
PrimaryShape.Fill.GradientDegree
|
||||
|
||||
ElseIf PrimaryShape.Fill.GradientColorType = msoGradientPresetColors Then
|
||||
|
||||
.Fill.PresetGradient PrimaryShape.Fill.GradientStyle, _
|
||||
|
||||
PrimaryShape.Fill.GradientVariant, _
|
||||
|
||||
PrimaryShape.Fill.PresetGradientType
|
||||
|
||||
ElseIf PrimaryShape.Fill.GradientColorType = msoGradientTwoColors Then
|
||||
|
||||
.Fill.TwoColorGradient PrimaryShape.Fill.GradientStyle, _
|
||||
|
||||
PrimaryShape.Fill.GradientVariant
|
||||
|
||||
End If
|
||||
|
||||
End With
|
||||
|
||||
Else
|
||||
|
||||
NoPrimaryShape
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Exit Sub
|
||||
|
||||
|
||||
|
||||
ErrHand:
|
||||
|
||||
Error_On_Apply
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
'Callback for SetOutline onAction
|
||||
|
||||
Sub SetOutline(control As IRibbonControl)
|
||||
|
||||
|
||||
|
||||
On Error GoTo ErrHand
|
||||
|
||||
|
||||
|
||||
If Not PrimaryShape Is Nothing Then
|
||||
|
||||
With GetShape
|
||||
|
||||
.Line.DashStyle = PrimaryShape.Line.DashStyle
|
||||
|
||||
'Weight must be set first, then colours, otherwise the colour does not change
|
||||
|
||||
'As noted by a not-very-upvoted answer on https://stackoverflow.com/questions/15624199/vba-power-point-changing-image-border-color-on-click
|
||||
|
||||
.Line.Weight = PrimaryShape.Line.Weight
|
||||
|
||||
.Line.Style = PrimaryShape.Line.Style
|
||||
|
||||
.Line.Transparency = PrimaryShape.Line.Transparency
|
||||
|
||||
.Line.ForeColor.RGB = PrimaryShape.Line.ForeColor.RGB
|
||||
|
||||
.Line.BackColor.RGB = PrimaryShape.Line.BackColor.RGB
|
||||
|
||||
End With
|
||||
|
||||
Else
|
||||
|
||||
NoPrimaryShape
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Exit Sub
|
||||
|
||||
|
||||
|
||||
ErrHand:
|
||||
|
||||
Error_On_Apply
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'Callback for SetDimCol onAction
|
||||
|
||||
Sub SetDimCol(control As IRibbonControl)
|
||||
|
||||
|
||||
|
||||
If Not PrimaryShape Is Nothing Then
|
||||
|
||||
With GetShape
|
||||
|
||||
|
||||
|
||||
On Error GoTo ErrHand
|
||||
|
||||
|
||||
|
||||
.Width = PrimaryShape.Width
|
||||
|
||||
.Height = PrimaryShape.Height
|
||||
|
||||
|
||||
|
||||
.Fill.BackColor.RGB = PrimaryShape.Fill.BackColor.RGB
|
||||
|
||||
.Fill.ForeColor.RGB = PrimaryShape.Fill.ForeColor.RGB
|
||||
|
||||
.Fill.Transparency = PrimaryShape.Fill.Transparency
|
||||
|
||||
If PrimaryShape.Fill.GradientColorType = msoGradientOneColor Or PrimaryShape.Fill.GradientColorType = msoGradientMultiColor Then
|
||||
|
||||
.Fill.OneColorGradient PrimaryShape.Fill.GradientStyle, _
|
||||
|
||||
PrimaryShape.Fill.GradientVariant, _
|
||||
|
||||
PrimaryShape.Fill.GradientDegree
|
||||
|
||||
ElseIf PrimaryShape.Fill.GradientColorType = msoGradientPresetColors Then
|
||||
|
||||
.Fill.PresetGradient PrimaryShape.Fill.GradientStyle, _
|
||||
|
||||
PrimaryShape.Fill.GradientVariant, _
|
||||
|
||||
PrimaryShape.Fill.PresetGradientType
|
||||
|
||||
ElseIf PrimaryShape.Fill.GradientColorType = msoGradientTwoColors Then
|
||||
|
||||
.Fill.TwoColorGradient PrimaryShape.Fill.GradientStyle, _
|
||||
|
||||
PrimaryShape.Fill.GradientVariant
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
.Line.DashStyle = PrimaryShape.Line.DashStyle
|
||||
|
||||
'Weight must be set first, then colours, otherwise the colour does not change
|
||||
|
||||
'As noted by a not-very-upvoted answer on https://stackoverflow.com/questions/15624199/vba-power-point-changing-image-border-color-on-click
|
||||
|
||||
.Line.Weight = PrimaryShape.Line.Weight
|
||||
|
||||
.Line.Style = PrimaryShape.Line.Style
|
||||
|
||||
.Line.Transparency = PrimaryShape.Line.Transparency
|
||||
|
||||
.Line.ForeColor.RGB = PrimaryShape.Line.ForeColor.RGB
|
||||
|
||||
.Line.BackColor.RGB = PrimaryShape.Line.BackColor.RGB
|
||||
|
||||
|
||||
|
||||
End With
|
||||
|
||||
Else
|
||||
|
||||
NoPrimaryShape
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Exit Sub
|
||||
|
||||
|
||||
|
||||
ErrHand:
|
||||
|
||||
Error_On_Apply
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
'Callback for SetDimPos onAction
|
||||
|
||||
Sub SetDimPos(control As IRibbonControl)
|
||||
|
||||
|
||||
|
||||
On Error GoTo ErrHand
|
||||
|
||||
|
||||
|
||||
If Not PrimaryShape Is Nothing Then
|
||||
|
||||
With GetShape
|
||||
|
||||
.Left = PrimaryShape.Left
|
||||
|
||||
.Top = PrimaryShape.Top
|
||||
|
||||
.Width = PrimaryShape.Width
|
||||
|
||||
.Height = PrimaryShape.Height
|
||||
|
||||
End With
|
||||
|
||||
Else
|
||||
|
||||
NoPrimaryShape
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Exit Sub
|
||||
|
||||
|
||||
|
||||
ErrHand:
|
||||
|
||||
Error_On_Apply
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
'Callback for SetAll onAction
|
||||
|
||||
Sub SetAll(control As IRibbonControl)
|
||||
|
||||
|
||||
|
||||
If Not PrimaryShape Is Nothing Then
|
||||
|
||||
With GetShape
|
||||
|
||||
|
||||
|
||||
On Error GoTo ErrHand
|
||||
|
||||
|
||||
|
||||
.Width = PrimaryShape.Width
|
||||
|
||||
.Height = PrimaryShape.Height
|
||||
|
||||
|
||||
|
||||
.Fill.BackColor.RGB = PrimaryShape.Fill.BackColor.RGB
|
||||
|
||||
.Fill.ForeColor.RGB = PrimaryShape.Fill.ForeColor.RGB
|
||||
|
||||
.Fill.Transparency = PrimaryShape.Fill.Transparency
|
||||
|
||||
If PrimaryShape.Fill.GradientColorType = msoGradientOneColor Or PrimaryShape.Fill.GradientColorType = msoGradientMultiColor Then
|
||||
|
||||
.Fill.OneColorGradient PrimaryShape.Fill.GradientStyle, _
|
||||
|
||||
PrimaryShape.Fill.GradientVariant, _
|
||||
|
||||
PrimaryShape.Fill.GradientDegree
|
||||
|
||||
ElseIf PrimaryShape.Fill.GradientColorType = msoGradientPresetColors Then
|
||||
|
||||
.Fill.PresetGradient PrimaryShape.Fill.GradientStyle, _
|
||||
|
||||
PrimaryShape.Fill.GradientVariant, _
|
||||
|
||||
PrimaryShape.Fill.PresetGradientType
|
||||
|
||||
ElseIf PrimaryShape.Fill.GradientColorType = msoGradientTwoColors Then
|
||||
|
||||
.Fill.TwoColorGradient PrimaryShape.Fill.GradientStyle, _
|
||||
|
||||
PrimaryShape.Fill.GradientVariant
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
.Line.DashStyle = PrimaryShape.Line.DashStyle
|
||||
|
||||
'Weight must be set first, then colours, otherwise the colour does not change
|
||||
|
||||
'As noted by a not-very-upvoted answer on https://stackoverflow.com/questions/15624199/vba-power-point-changing-image-border-color-on-click
|
||||
|
||||
.Line.Weight = PrimaryShape.Line.Weight
|
||||
|
||||
.Line.Style = PrimaryShape.Line.Style
|
||||
|
||||
.Line.Transparency = PrimaryShape.Line.Transparency
|
||||
|
||||
.Line.ForeColor.RGB = PrimaryShape.Line.ForeColor.RGB
|
||||
|
||||
.Line.BackColor.RGB = PrimaryShape.Line.BackColor.RGB
|
||||
|
||||
|
||||
|
||||
.Left = PrimaryShape.Left
|
||||
|
||||
.Top = PrimaryShape.Top
|
||||
|
||||
|
||||
|
||||
End With
|
||||
|
||||
Else
|
||||
|
||||
NoPrimaryShape
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Exit Sub
|
||||
|
||||
|
||||
|
||||
ErrHand:
|
||||
|
||||
Error_On_Apply
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
'Callback for SyncValueAxis onAction
|
||||
|
||||
Sub SyncValueAxis(control As IRibbonControl)
|
||||
|
||||
|
||||
|
||||
Dim y_primary As Boolean
|
||||
|
||||
Dim y_secondary As Boolean
|
||||
|
||||
|
||||
|
||||
y_primary = False
|
||||
|
||||
y_secondary = False
|
||||
|
||||
|
||||
|
||||
If Not PrimaryShape Is Nothing Then
|
||||
|
||||
With GetShape
|
||||
|
||||
|
||||
|
||||
If .HasChart = msoFalse Or PrimaryShape.HasChart = msoFalse Then
|
||||
|
||||
MsgBox "This is not a chart. Please select charts.", vbCritical, "Note"
|
||||
|
||||
Exit Sub
|
||||
|
||||
|
||||
|
||||
Else
|
||||
|
||||
|
||||
|
||||
If PrimaryShape.Chart.HasAxis(xlValue, xlPrimary) Then y_primary = True
|
||||
|
||||
|
||||
|
||||
With .Chart
|
||||
|
||||
.HasAxis(xlValue, xlPrimary) = True
|
||||
|
||||
PrimaryShape.Chart.HasAxis(xlValue, xlPrimary) = True
|
||||
|
||||
.Axes(xlValue, xlPrimary).MinimumScale = _
|
||||
|
||||
PrimaryShape.Chart.Axes(xlValue, xlPrimary).MinimumScale
|
||||
|
||||
312
Code/CustomDataLabel.frm
Normal file
312
Code/CustomDataLabel.frm
Normal file
@@ -0,0 +1,312 @@
|
||||
Attribute VB_Name = "CustomDataLabel"
|
||||
|
||||
Attribute VB_Base = "0{FB1A5CF6-B322-4663-8D98-1EA550257031}{5DE1A105-7A12-40DC-A8A7-EB3034AE1800}"
|
||||
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
|
||||
Attribute VB_Creatable = False
|
||||
|
||||
Attribute VB_PredeclaredId = True
|
||||
|
||||
Attribute VB_Exposed = False
|
||||
|
||||
Attribute VB_TemplateDerived = False
|
||||
|
||||
Attribute VB_Customizable = False
|
||||
|
||||
Private Sub HideUserForm_Click()
|
||||
|
||||
|
||||
|
||||
Me.Hide
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub FillEveryNValuesCheckbox_AfterUpdate()
|
||||
|
||||
|
||||
|
||||
If FillEveryNValuesCheckbox.Value = True Then
|
||||
|
||||
FillEveryNValuesTextBox.Enabled = True
|
||||
|
||||
FillEveryNValueHelpLabel.Enabled = True
|
||||
|
||||
FillEveryNValuesTextBox.Text = 2
|
||||
|
||||
FillEveryNValuesTextBoxOffset.Enabled = True
|
||||
|
||||
FillEveryNValuesTextBoxOffset.Text = 0
|
||||
|
||||
Else
|
||||
|
||||
FillEveryNValuesTextBox.Enabled = False
|
||||
|
||||
FillEveryNValueHelpLabel.Enabled = False
|
||||
|
||||
FillEveryNValuesTextBoxOffset.Enabled = False
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub FillEveryNValuesTextBoxOffset_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
|
||||
|
||||
|
||||
If FillEveryNValuesTextBoxOffset.Text = "" Then
|
||||
|
||||
FillEveryNValuesTextBoxOffset.Text = 0
|
||||
|
||||
ElseIf Not IsNumeric(FillEveryNValuesTextBoxOffset.Value) Then
|
||||
|
||||
MsgBox "Please input only integers here.", vbCritical, "Note"
|
||||
|
||||
Cancel = True
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub FillEveryNValuesTextBox_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
|
||||
|
||||
|
||||
If FillEveryNValuesTextBox.Text = "" Then
|
||||
|
||||
FillEveryNValuesTextBox.Text = 2
|
||||
|
||||
ElseIf Not IsNumeric(FillEveryNValuesTextBox.Value) Then
|
||||
|
||||
MsgBox "Please input only integers here.", vbCritical, "Note"
|
||||
|
||||
Cancel = True
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub FilterBetweenCheckBox_AfterUpdate()
|
||||
|
||||
|
||||
|
||||
If FilterBetweenCheckBox.Value = True Then
|
||||
|
||||
|
||||
|
||||
FilterBetweenLowerBound.Enabled = True
|
||||
|
||||
FilterBetweenUpperBound.Enabled = True
|
||||
|
||||
FilterBetweenLabel.Enabled = True
|
||||
|
||||
|
||||
|
||||
Else
|
||||
|
||||
|
||||
|
||||
FilterBetweenLowerBound.Enabled = False
|
||||
|
||||
FilterBetweenUpperBound.Enabled = False
|
||||
|
||||
FilterBetweenLabel.Enabled = True
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub FilterBetweenLowerBound_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
|
||||
|
||||
|
||||
If Not IsNumeric(FilterBetweenLowerBound.Value) Then
|
||||
|
||||
MsgBox "Please input a number here, or disable the option to filter between values after you enter a number here.", vbCritical, "Note"
|
||||
|
||||
Cancel = True
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub FilterBetweenUpperBound_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
|
||||
|
||||
|
||||
If Not IsNumeric(FilterBetweenUpperBound.Value) Then
|
||||
|
||||
MsgBox "Please input a number here, or disable the option to filter between values after you enter a number here.", vbCritical, "Note"
|
||||
|
||||
Cancel = True
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub FirstValueCheckBox_AfterUpdate()
|
||||
|
||||
|
||||
|
||||
If FirstValueCheckBox.Value = True Or LastValueCheckBox = True Then
|
||||
|
||||
AlignFirstLastCheckBox.Enabled = True
|
||||
|
||||
Else
|
||||
|
||||
AlignFirstLastCheckBox.Enabled = False
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub LastValueCheckBox_AfterUpdate()
|
||||
|
||||
|
||||
|
||||
If FirstValueCheckBox.Value = True Or LastValueCheckBox = True Then
|
||||
|
||||
AlignFirstLastCheckBox.Enabled = True
|
||||
|
||||
Else
|
||||
|
||||
AlignFirstLastCheckBox.Enabled = False
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub MaxValueCheckBox_AfterUpdate()
|
||||
|
||||
|
||||
|
||||
If MaxValueCheckBox.Value = True Or MinValueCheckBox.Value = True Then
|
||||
|
||||
ApplyBySeriesCheckBox.Enabled = True
|
||||
|
||||
Else
|
||||
|
||||
ApplyBySeriesCheckBox.Enabled = False
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub MinValueCheckBox_AfterUpdate()
|
||||
|
||||
|
||||
|
||||
If MaxValueCheckBox.Value = True Or MinValueCheckBox.Value = True Then
|
||||
|
||||
ApplyBySeriesCheckBox.Enabled = True
|
||||
|
||||
Else
|
||||
|
||||
ApplyBySeriesCheckBox.Enabled = False
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Private Sub CommandButton1_Click()
|
||||
|
||||
|
||||
|
||||
For i = 0 To ListBox1.ListCount - 1
|
||||
|
||||
|
||||
|
||||
present = False
|
||||
|
||||
|
||||
|
||||
If ListBox2.ListCount <> 0 Then
|
||||
|
||||
|
||||
|
||||
'Identify if the item selected already exists in ListBox2
|
||||
|
||||
For j = 0 To ListBox2.ListCount - 1
|
||||
|
||||
If ListBox1.List(i) = ListBox2.List(j) Then present = True
|
||||
|
||||
Next
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If ListBox1.Selected(i) = True And present = False Then ListBox2.AddItem ListBox1.List(i)
|
||||
|
||||
|
||||
|
||||
CommandButton2.Enabled = True
|
||||
|
||||
|
||||
|
||||
Next
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub CommandButton2_Click()
|
||||
|
||||
|
||||
|
||||
ListBox1.ListIndex = -1
|
||||
|
||||
ListBox2.Clear
|
||||
|
||||
CommandButton2.Enabled = False
|
||||
|
||||
59
Code/HideX.bas
Normal file
59
Code/HideX.bas
Normal file
@@ -0,0 +1,59 @@
|
||||
Attribute VB_Name = "HideX"
|
||||
|
||||
'Include this code at the top of the module
|
||||
|
||||
Private Const GWL_STYLE = -16
|
||||
|
||||
Private Const WS_CAPTION = &HC00000
|
||||
|
||||
Private Const WS_SYSMENU = &H80000
|
||||
|
||||
|
||||
|
||||
#If VBA7 Then
|
||||
|
||||
|
||||
|
||||
Private Declare PtrSafe Function GetWindowLong _
|
||||
|
||||
Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, _
|
||||
|
||||
ByVal nIndex As Long) As Long
|
||||
|
||||
Private Declare PtrSafe Function SetWindowLong _
|
||||
|
||||
Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, _
|
||||
|
||||
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
|
||||
|
||||
Private Declare PtrSafe Function FindWindowA _
|
||||
|
||||
Lib "user32" (ByVal lpClassName As String, _
|
||||
|
||||
ByVal lpWindowName As String) As Long
|
||||
|
||||
Private Declare PtrSafe Function DrawMenuBar _
|
||||
|
||||
Lib "user32" (ByVal hWnd As Long) As Long
|
||||
|
||||
|
||||
|
||||
#Else
|
||||
|
||||
|
||||
|
||||
Private Declare Function GetWindowLong _
|
||||
|
||||
Lib "user32" Alias "GetWindowLongA" ( _
|
||||
|
||||
ByVal hWnd As Long, ByVal nIndex As Long) As Long
|
||||
|
||||
Private Declare Function SetWindowLong _
|
||||
|
||||
Lib "user32" Alias "SetWindowLongA" ( _
|
||||
|
||||
ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
|
||||
|
||||
Private Declare Function FindWindowA _
|
||||
|
||||
Lib "user32" (ByVal lpClassName As String, _
|
||||
82
Code/customUI/customUI14.xml
Normal file
82
Code/customUI/customUI14.xml
Normal file
@@ -0,0 +1,82 @@
|
||||
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
|
||||
<ribbon startFromScratch="false">
|
||||
<tabs>
|
||||
<tab id="snap" label="Snap">
|
||||
<group id="set" label="Set">
|
||||
<button id="LockShape" label="Snap Object" imageMso="PositionAbsoluteMarks" size="large" onAction="LockShape"
|
||||
screentip="Set Primary Shape"
|
||||
supertip ="Set a particular shape as the primary one to reference properties i.e. 'Snap' from."/>
|
||||
</group>
|
||||
<group id="SnapToShape" label="Shapes">
|
||||
<button id="SetLength" label="Height" imageMso="PageScaleToFitHeight" size="normal" onAction="SetHeight"
|
||||
screentip="Snap height to primary"
|
||||
supertip ="Set the height of the chosen shape to that of the primary shape." />
|
||||
<button id="SetWidth" label="Width" imageMso="PageScaleToFitWidth" size="normal" onAction="SetWidth"
|
||||
screentip="Snap width to primary"
|
||||
supertip ="Set the width of the chosen shape to that of the primary shape." />
|
||||
<button id="SetDimesion" label="Dim" imageMso="ZoomFitToWindow" size="normal" onAction="SetDimension"
|
||||
screentip="Snap dimensions to primary"
|
||||
supertip ="Set the height and width of the chosen shape to that of the primary shape."/>
|
||||
<button id="SetFill" label="Fill" imageMso="ViewDisplayInColor" size="normal" onAction="SetFill"
|
||||
screentip="Snap fill to primary"
|
||||
supertip ="Set the fill colour and type of the chosen shape to that of the primary shape. This does not work well for charts and tables."/>
|
||||
<button id="SetOutline" label="Outline" imageMso="ControlRectangle" size="normal" onAction="SetOutline"
|
||||
screentip="Snap outline to primary"
|
||||
supertip ="Set the outline colour and type of the chosen shape to that of the primary shape. This does not work well for charts and tables."/>
|
||||
<button id="SetDimCol" label="Dim + Colour" imageMso="PictureStylesGallery" size="normal" onAction="SetDimCol"
|
||||
screentip="Snap dimensions and colours to primary"
|
||||
supertip ="Set the dimensions and colours of the chosen shape to that of the primary shape. This does not work well for charts and tables."/>
|
||||
<button id="SetPosition" label="Position" imageMso="PositionFitToWindow" size="normal" onAction="SetPosition"
|
||||
screentip="Snap position to primary"
|
||||
supertip ="Set the position of the chosen shape to that of the primary shape. Note that this will place the current shape over the primary shape if on the same slide."/>
|
||||
<button id="SetDimPos" label="Dim + Pos" imageMso="ShowTaskDetailsPage" size="normal" onAction="SetDimPos"
|
||||
screentip="Snap dimension and position to primary"
|
||||
supertip ="Set the dimension and position of the chosen shape to that of the primary shape."/>
|
||||
<button id="SetAll" label="All" imageMso="SharingRequestAllow" size="normal" onAction="SetAll"
|
||||
screentip="Snap all properties to primary"
|
||||
supertip ="Set the properties mentioned here of the chosen shape to that of the primary shape. This does not work well for charts and tables."/>
|
||||
</group>
|
||||
<group id="SnapToChart" label="Charts">
|
||||
<button id="SyncValueAxis" label="Sync Value Axis" imageMso="ChartPrimaryHorizontalAxis" size="normal" onAction="SyncValueAxis"
|
||||
screentip="Snap continous axis to primary"
|
||||
supertip ="Sets the value based continous axis of current chosen chart to have the same scale and number format as that of the primary chart. Usually implments on Y axis."/>
|
||||
<button id="SyncDateAxis" label="Sync Date Axis" imageMso="ChartPrimaryHorizontalAxis" size="normal" onAction="SyncDateAxis"
|
||||
screentip="Snap date axis to primary"
|
||||
supertip ="Sets the date based continuous axis of current chosen chart to have the same scale and date/number format as that of the primary chart. Usually implments on X axis. For scatter plots, this will treat the X axis as a value axis."/>
|
||||
<button id="SyncPlotArea" label="Sync Plot Area" imageMso="ChartPlotArea" size="normal" onAction="SyncPlotArea"
|
||||
screentip="Snap Plot Area location and dimensions"
|
||||
supertip ="Snap a PlotArea's dimensions and position that of another chart - also resizes the chart to accomodate the PlotArea dimensions."/>
|
||||
<button id="SyncTitleArea" label="Sync Title Area" imageMso="ChartTitle" size="normal" onAction="SyncTitleArea"
|
||||
screentip="Snap Title Area location "
|
||||
supertip ="This will position the title to the corresponding centre location of the Primary Chart's title. Works best when chart dimensions of both are the same."/>
|
||||
<button id="SyncLegendArea" label="Sync Legend" imageMso="ChartLegend" size="normal" onAction="SyncLegendArea"
|
||||
screentip="Snap Legend location and dimensions"
|
||||
supertip ="Snap Legend location and dimensions - might change format to reduce size to allow it to fit."/>
|
||||
<button id="FormatPainter" label="Format Painter" imageMso="FormatPainter" size="normal" onAction="FormatPainter"
|
||||
screentip="Convinience function that mimicks the built in FormatPainter"
|
||||
supertip ="You will need to first Snap a shape and then use FormatPainter to copy object properties."/>
|
||||
<button id="ResetAxis" label="Reset Axes Scales" imageMso="ChartResetToMatchStyle" size="normal" onAction="ResetAxis"
|
||||
screentip="Reset to allow Excel to auto-set the value axis."
|
||||
supertip ="Convinience function to undo 'Sync Axes' easily."/>
|
||||
<button id="CustomizeDataLabels" label="Customize Labels" imageMso="ChartDataLabel" size="normal" onAction="CustomizeDataLabels"
|
||||
screentip="Customize data labels to show only specific values."
|
||||
supertip ="Choose from a wide range of values to fill from - max, min, first, last or every N values to highlight"/>
|
||||
<button id="RerunCustomLabels" label="Rerun Customization" imageMso="ChartDataLabel" size="normal" onAction="RerunCustomLabels"
|
||||
screentip="Rerun customization of data labels"
|
||||
supertip ="This will allow you to rerun the same data label customization applied earlier if you clicked Save and Run"/>
|
||||
</group>
|
||||
<group id="SnapToTable" label="Tables">
|
||||
<button id="SetColWidths" label="Sync Column Widths" imageMso="TableWidth" size="normal" onAction="SyncColumnWidth"
|
||||
screentip="Snap column widths to primary"
|
||||
supertip ="Possible currently only for tables with identical column counts. Syncs the width of each individual column to the corresponding one in primary."/>
|
||||
<button id="SetRowHeight" label="Sync Row Widths" imageMso="TableHeight" size="normal" onAction="SyncRowHeight"
|
||||
screentip="Snap row heights to primary"
|
||||
supertip ="Possible currently only for tables with identical row counts. Syncs the height of each individual row to the corresponding one in primary."/>
|
||||
<button id="SetTableDims" label="Sync Both Widths" imageMso="ZoomFitToWindow" size="normal" onAction="SyncTableDims"
|
||||
screentip="Snap cell dimensions to primary"
|
||||
supertip ="Possible currently only for tables with identical row and column counts. Syncs the dimension of each individual cell to the corresponding one in primary."/>
|
||||
</group>
|
||||
</tab>
|
||||
</tabs>
|
||||
</ribbon>
|
||||
</customUI>
|
||||
Reference in New Issue
Block a user