Guttmann1983
Board Regular
- Joined
- Jul 27, 2015
- Messages
- 181
Hi - I tried adding a command button and formatting / linking it to a macro but all it is doing is creating the button. Can anyone please point out my error?
Code:
Dim cBut As OLEObjectWith ActiveSheet
Set cBut = .OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False _
, DisplayAsIcon:=False, Left:=204.75, Top:=19.5, Width:=142.5, Height _
:=52.5).Select
End With
With cBut
.IncrementLeft 9.75
.IncrementTop -6.75
.BackColor = &H80000001
.ForeColor = &H80000004
.Caption = "Click here to email a copy of this spreadsheet"
.Font.Size = 10
.Font.Name = "Arial"
.TextAlign = fmTextAlignCenter
End With
Range("K4").Select
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUppdating = True
Application.StatusBar = True
Application.DisplayAlerts = True
End Sub
Private Sub CommandButton1_Click()
Mail_workbook_Outlook_2
End Sub