I tried to create a button in a file using VBA editor but I also want the button to action a task when clicked but that is not happening
When clicked on the button, a copy of the file should be saved in a particular folder.
Creating a button works but saving the file doesnt. Need help
Code below:
Regards,
When clicked on the button, a copy of the file should be saved in a particular folder.
Creating a button works but saving the file doesnt. Need help
Code below:
VBA Code:
'Creating a button
ActiveCell.Offset(2, 0).Select
Dim c As Range
Set c = ActiveCell.Offset(2, 0)
With ActiveSheet.Buttons.Add(c.Left, c.Top, c.Width, c.Height)
.OnAction = "BtnMacro"
.Caption = "Save_File"
.Font.Bold = True
.Font.Name = "Calibri"
.Font.Size = 10
.Name = "Save File " & c.Row
.Shapes("BtnMacro").OnAction = ThisWorkbook.SaveAs Filename:="\\abcd\ ".xls", FileFormat:=56
End With
Regards,
Last edited by a moderator: