C
Colonel Blip
Ed,
You were kind enough to help me create the following vba code for publisher
2k3 several month ago. I recently had to install a new m/b and all of my
apps and for some reason this code _doesn't seem_ to work anymore. I say
that because no longer do the toolbar buttons get created. I suspect it has
something to do with my security. I self certified the original code and I
am thinking maybe my certification is invalid. Would the best way to proceed
be delete the vba code, recreate it (i.e. copy/paste back) and self cert
again to get it to work? Or am I missing something basic here?
Thanks,
Colonel Blip.
E-mail: (e-mail address removed)
Dim WithEvents cbbMyButton1 As Office.CommandBarButton
Dim WithEvents cbbMyButton2 As Office.CommandBarButton
Dim WithEvents cbbMyButton3 As Office.CommandBarButton
Dim InitialWindowState As Integer
'This is to handle 4x5.5 resizing
Private Sub cbbMyButton1_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
With ThisDocument.Selection
If Not .ShapeRange.Count = 1 Then
Beep
Else
With .ShapeRange(1)
If .Width >= .Height Then
..Width = 396
..Height = 288
Else
..Width = 288
..Height = 396
End If
End With
End If
End With
End Sub
'This will handle 4x6 resizing
Private Sub cbbMyButton2_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
With ThisDocument.Selection
If Not .ShapeRange.Count = 1 Then
Beep
Else
With .ShapeRange(1)
If .Width >= .Height Then
..Width = 432
..Height = 288
Else
..Width = 288
..Height = 432
End If
End With
End If
End With
End Sub
'This is to handle 8x10 resizing
Private Sub cbbMyButton3_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
With ThisDocument.Selection
If Not .ShapeRange.Count = 1 Then
Beep
Else
With .ShapeRange(1)
If .Width >= .Height Then
..Width = 720
..Height = 576
Else
..Width = 576
..Height = 720
End If
End With
End If
End With
End Sub
Private Sub Document_BeforeClose(Cancel As Boolean)
On Error Resume Next
CommandBars("WLO Custom").Controls("Resize selection to 4"" by
5.5""").Delete
CommandBars("WLO Custom").Controls("Resize selection to 4"" by 6""").Delete
CommandBars("WLO Custom").Controls("Resize selection to 8"" by 10""").Delete
End Sub
Private Sub Document_Open()
'The 4x5.5 button on open
On Error Resume Next
Set cbbMyButton1 = CommandBars("WLO Custom").Controls.Add(, , , , True)
cbbMyButton1.FaceId = 494
cbbMyButton1.Caption = "Resize selection to 4"" by 5.5"""
'The 4x6 button on open
On Error Resume Next
Set cbbMyButton2 = CommandBars("WLO Custom").Controls.Add(, , , , True)
cbbMyButton2.FaceId = 495
cbbMyButton2.Caption = "Resize selection to 4"" by 6"""
'The 8x10 button on open
Set cbbMyButton3 = CommandBars("WLO Custom").Controls.Add(, , , , True)
cbbMyButton3.FaceId = 490
cbbMyButton3.Caption = "Resize selection to 8"" by 10"""
'This 'flashes' the document so the buttons show up
InitialWindowState = ThisDocument.ActiveWindow.WindowState
ThisDocument.ActiveWindow.WindowState = pbWindowStateMinimize
ThisDocument.ActiveWindow.WindowState = InitialWindowState
End Sub
You were kind enough to help me create the following vba code for publisher
2k3 several month ago. I recently had to install a new m/b and all of my
apps and for some reason this code _doesn't seem_ to work anymore. I say
that because no longer do the toolbar buttons get created. I suspect it has
something to do with my security. I self certified the original code and I
am thinking maybe my certification is invalid. Would the best way to proceed
be delete the vba code, recreate it (i.e. copy/paste back) and self cert
again to get it to work? Or am I missing something basic here?
Thanks,
Colonel Blip.
E-mail: (e-mail address removed)
Dim WithEvents cbbMyButton1 As Office.CommandBarButton
Dim WithEvents cbbMyButton2 As Office.CommandBarButton
Dim WithEvents cbbMyButton3 As Office.CommandBarButton
Dim InitialWindowState As Integer
'This is to handle 4x5.5 resizing
Private Sub cbbMyButton1_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
With ThisDocument.Selection
If Not .ShapeRange.Count = 1 Then
Beep
Else
With .ShapeRange(1)
If .Width >= .Height Then
..Width = 396
..Height = 288
Else
..Width = 288
..Height = 396
End If
End With
End If
End With
End Sub
'This will handle 4x6 resizing
Private Sub cbbMyButton2_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
With ThisDocument.Selection
If Not .ShapeRange.Count = 1 Then
Beep
Else
With .ShapeRange(1)
If .Width >= .Height Then
..Width = 432
..Height = 288
Else
..Width = 288
..Height = 432
End If
End With
End If
End With
End Sub
'This is to handle 8x10 resizing
Private Sub cbbMyButton3_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
With ThisDocument.Selection
If Not .ShapeRange.Count = 1 Then
Beep
Else
With .ShapeRange(1)
If .Width >= .Height Then
..Width = 720
..Height = 576
Else
..Width = 576
..Height = 720
End If
End With
End If
End With
End Sub
Private Sub Document_BeforeClose(Cancel As Boolean)
On Error Resume Next
CommandBars("WLO Custom").Controls("Resize selection to 4"" by
5.5""").Delete
CommandBars("WLO Custom").Controls("Resize selection to 4"" by 6""").Delete
CommandBars("WLO Custom").Controls("Resize selection to 8"" by 10""").Delete
End Sub
Private Sub Document_Open()
'The 4x5.5 button on open
On Error Resume Next
Set cbbMyButton1 = CommandBars("WLO Custom").Controls.Add(, , , , True)
cbbMyButton1.FaceId = 494
cbbMyButton1.Caption = "Resize selection to 4"" by 5.5"""
'The 4x6 button on open
On Error Resume Next
Set cbbMyButton2 = CommandBars("WLO Custom").Controls.Add(, , , , True)
cbbMyButton2.FaceId = 495
cbbMyButton2.Caption = "Resize selection to 4"" by 6"""
'The 8x10 button on open
Set cbbMyButton3 = CommandBars("WLO Custom").Controls.Add(, , , , True)
cbbMyButton3.FaceId = 490
cbbMyButton3.Caption = "Resize selection to 8"" by 10"""
'This 'flashes' the document so the buttons show up
InitialWindowState = ThisDocument.ActiveWindow.WindowState
ThisDocument.ActiveWindow.WindowState = pbWindowStateMinimize
ThisDocument.ActiveWindow.WindowState = InitialWindowState
End Sub