Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

VBA Print code?????

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Watson - 23 Mar 2006 13:39 GMT
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
Duke Carey - 23 Mar 2006 14:01 GMT
very simplistic

Dim i As Integer

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

> 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.
raymond.allan@bench.com - 23 Mar 2006 14:18 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.