Pinging Ed Bennett for help on this one

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
 
E

Ed Bennett

Colonel Blip said:
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?

That is what I am guessing would be the best solution, and this is what I
suggested in a reply to your post in .programming on 19/4/2005
 
C

Colonel Blip

Hello, Ed!
You wrote on Tue, 26 Apr 2005 20:00:47 +0100:

Sorry for what might have sounded like a question from someone not
listening. With the new m/b I lost all of my newsgroup stores so had to
start over and I've slept more than once since my note in programming and
had forgotten all about it with other problems I was having. <g>

Downloaded programming newsgroup messages and found the one you referenced.
I knew my idea to fix this was too good to be my own. <g>

In any event, I redid the macro and did another selfcert and all is well,
including elimination of the problem which initiated the programming
question.

Thanks again,

Colonel Blip.
E-mail: (e-mail address removed)

EB> Colonel Blip <[email protected]> was very recently
??>> Would the best way to proceed be delete the vba code,
EB> That is what I am guessing would be the best solution, and this is what
EB> I suggested in a reply to your post in .programming on 19/4/2005
 
E

Ed Bennett

Colonel Blip said:
In any event, I redid the macro and did another selfcert and all is
well, including elimination of the problem which initiated the
programming question.

Glad to hear you fixed your problem :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top