ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Programming commands (https://www.excelbanter.com/excel-discussion-misc-queries/206383-programming-commands.html)

CP

Programming commands
 
I have just added a couple of buttons to my work book and i wish them to
carry out two tasks
The 2 buttons are on sheet1

1) print sheet3 to default printer
2) close excel without saving or asking to

I am ok with getting to the coding screen however I just dont know what to
write in the visual basic box to perform the tasks

Thank you

Daniel.C

Programming commands
 
1.
Sheets("sheet3").PrintOut (beware of the case)
2.
Application.DisplayAlerts = False
Application.Quit
--
Regards.
Daniel
"CP" a écrit dans le message de news:
...
I have just added a couple of buttons to my work book and i wish them to
carry out two tasks
The 2 buttons are on sheet1

1) print sheet3 to default printer
2) close excel without saving or asking to

I am ok with getting to the coding screen however I just dont know what to
write in the visual basic box to perform the tasks

Thank you




Per Jessen[_2_]

Programming commands
 
Hi

With the two buttons named CommandButton1 and 2 insert theese two
macros in the codesheet for sheet1

Private Sub CommandButton1_Click()
Sheets("Sheet3").PrintOut
End Sub

Private Sub CommandButton2_Click()
ThisWorkbook.Close Savechanges = False
End Sub

Regards,
Per

On 15 Okt., 12:15, CP wrote:
I have just added a couple of buttons to my work book and i wish them to
carry out two tasks
The 2 buttons are on sheet1

1) print sheet3 to default printer
2) close excel without saving or asking to

I am ok with getting to the coding screen however I just dont know what to
write in the visual basic box to perform the tasks

Thank you




All times are GMT +1. The time now is 09:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com