Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Print code?????


Can anybody give me the VBA code for a command button that will prin
the active worksheet and also give the user the option to select ho
many

--
Chris Watso
-----------------------------------------------------------------------
Chris Watson's Profile: http://www.excelforum.com/member.php...nfo&userid=470
View this thread: http://www.excelforum.com/showthread.php?threadid=52564

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,081
Default VBA Print code?????

very simplistic

Dim i As Integer

i = InputBox("How many copies")
ActiveSheet.PrintOut copies:=i


"Chris Watson" wrote:


Can anybody give me the VBA code for a command button that will print
the active worksheet and also give the user the option to select how
many.


--
Chris Watson
------------------------------------------------------------------------
Chris Watson's Profile: http://www.excelforum.com/member.php...fo&userid=4700
View this thread: http://www.excelforum.com/showthread...hreadid=525646


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default VBA Print code?????


Create the button and associate it with this code

Sub Print_Sheet()

Dim Message, Title, Default, MyValue
Message = "Enter Number Of Copies To Print" ' Set prompt.
Title = "Print" ' Set title.
Default = "1" ' Set default.
MyValue = InputBox(Message, Title, Default)

If Not IsNumeric(MyValue) Then
MsgBox "Please enter a vilid number", vbInformation
GoTo NoPrinting
End If

ActiveWindow.SelectedSheets.PrintOut Copies:=MyValue

NoPrinting:

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Code Scott Excel Discussion (Misc queries) 2 September 8th 08 04:36 PM
Code before Print but not Print Preview widemonk Excel Programming 1 November 14th 05 01:48 PM
Need Code To Print From Code Modules davidm Excel Programming 0 June 7th 05 06:11 AM
Need Code To Print From Code Modules davidm Excel Programming 0 June 7th 05 06:08 AM
Need print code please Rodders[_2_] Excel Programming 2 September 20th 03 12:35 AM


All times are GMT +1. The time now is 11:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"