Button To Print Workbook With Certain Settings

hi, in a workbook i have 52 numbered sheets. they are 
numbered 1, 2, 3, 4 etc. on the first sheet i have two 
buttons. i need some coding help with the buttons. 
basically i want the first button (called even) to print 
all the even sheets in the workbook. and the second 
button will print the odd sheets in the workbook. also i 
want different margin settings for each button. the even 
button will need a left margin of 0.5 and the odd button 
will need a right margin of 0.5 - while all the other 
margins remain 0.2. i am hoping that this is possible. i 
tried recording the marcos but i am not sure how i can 
get it to print the evenly and oddly numbered sheets (not 
pages). thanks in advance. 
0
anonymous (74717)
7/7/2004 7:55:36 PM
excel.misc 78881 articles. 5 followers. Follow

3 Replies
378 Views

Similar Articles

[PageSpeed] 16

Hi kishan

Left margin : This setting will be saved with the file.
If you want to do it with code post back

Change PrintPreview to PrintOut to print


Sub test1()
Dim shnum As Long
For shnum = 1 To Sheets.Count Step 2
Sheets(shnum).PrintPreview
Next
End Sub

Sub test2()
Dim shnum As Long
For shnum = 2 To Sheets.Count Step 2
Sheets(shnum).PrintPreview
Next
End Sub


-- 
Regards Ron de Bruin
http://www.rondebruin.nl


"kishan" <anonymous@discussions.microsoft.com> wrote in message news:2892901c4645c$5eeaee00$a401280a@phx.gbl...
> hi, in a workbook i have 52 numbered sheets. they are
> numbered 1, 2, 3, 4 etc. on the first sheet i have two
> buttons. i need some coding help with the buttons.
> basically i want the first button (called even) to print
> all the even sheets in the workbook. and the second
> button will print the odd sheets in the workbook. also i
> want different margin settings for each button. the even
> button will need a left margin of 0.5 and the odd button
> will need a right margin of 0.5 - while all the other
> margins remain 0.2. i am hoping that this is possible. i
> tried recording the marcos but i am not sure how i can
> get it to print the evenly and oddly numbered sheets (not
> pages). thanks in advance.


0
rondebruin (3789)
7/7/2004 8:08:22 PM
hi, i read this post and i was wondering if i could have 
the coding for the margin settings. this is because i 
want different margins based on which button is pressed.

eg, when the even button is pressed the margins are:
 -- top = 0.5
 -- left = 0.2
 -- right = 0.5
 -- bottom = 0.5

when the odd button is pressed the margins are:
 -- top = 0.5
 -- left = 0.5
 -- right = 0.2
 -- bottom = 0.5

thanks agen. 


>-----Original Message-----
>Hi kishan
>
>Left margin : This setting will be saved with the file.
>If you want to do it with code post back
>
>Change PrintPreview to PrintOut to print
>
>
>Sub test1()
>Dim shnum As Long
>For shnum = 1 To Sheets.Count Step 2
>Sheets(shnum).PrintPreview
>Next
>End Sub
>
>Sub test2()
>Dim shnum As Long
>For shnum = 2 To Sheets.Count Step 2
>Sheets(shnum).PrintPreview
>Next
>End Sub
>
>
>-- 
>Regards Ron de Bruin
>http://www.rondebruin.nl
>
>
>"kishan" <anonymous@discussions.microsoft.com> wrote in 
message news:2892901c4645c$5eeaee00$a401280a@phx.gbl...
>> hi, in a workbook i have 52 numbered sheets. they are
>> numbered 1, 2, 3, 4 etc. on the first sheet i have two
>> buttons. i need some coding help with the buttons.
>> basically i want the first button (called even) to 
print
>> all the even sheets in the workbook. and the second
>> button will print the odd sheets in the workbook. also 
i
>> want different margin settings for each button. the 
even
>> button will need a left margin of 1 and the odd button
>> will need a right margin of 2 - while all the other
>> margins remain 2. i am hoping that this is possible. i
>> tried recording the marcos but i am not sure how i can
>> get it to print the evenly and oddly numbered sheets 
(not
>> pages). thanks in advance.
>
>
>.
>
0
anonymous (74717)
7/17/2004 3:51:49 PM
Try this Jay

Sub test()
    Dim shnum As Long
    For shnum = 2 To Sheets.Count Step 2
        With Sheets(shnum).PageSetup
            .LeftMargin = Application.InchesToPoints(0.2)
            .RightMargin = Application.InchesToPoints(0.5)
            .TopMargin = Application.InchesToPoints(0.5)
            .BottomMargin = Application.InchesToPoints(0.5)
        End With
        Sheets(shnum).PrintPreview
    Next
End Sub


-- 
Regards Ron de Bruin
http://www.rondebruin.nl


"jay" <anonymous@discussions.microsoft.com> wrote in message news:01a901c46c15$f8c21b00$7d02280a@phx.gbl...
> hi, i read this post and i was wondering if i could have
> the coding for the margin settings. this is because i
> want different margins based on which button is pressed.
>
> eg, when the even button is pressed the margins are:
>  -- top = 0.5
>  -- left = 0.2
>  -- right = 0.5
>  -- bottom = 0.5
>
> when the odd button is pressed the margins are:
>  -- top = 0.5
>  -- left = 0.5
>  -- right = 0.2
>  -- bottom = 0.5
>
> thanks agen.
>
>
> >-----Original Message-----
> >Hi kishan
> >
> >Left margin : This setting will be saved with the file.
> >If you want to do it with code post back
> >
> >Change PrintPreview to PrintOut to print
> >
> >
> >Sub test1()
> >Dim shnum As Long
> >For shnum = 1 To Sheets.Count Step 2
> >Sheets(shnum).PrintPreview
> >Next
> >End Sub
> >
> >Sub test2()
> >Dim shnum As Long
> >For shnum = 2 To Sheets.Count Step 2
> >Sheets(shnum).PrintPreview
> >Next
> >End Sub
> >
> >
> >-- 
> >Regards Ron de Bruin
> >http://www.rondebruin.nl
> >
> >
> >"kishan" <anonymous@discussions.microsoft.com> wrote in
> message news:2892901c4645c$5eeaee00$a401280a@phx.gbl...
> >> hi, in a workbook i have 52 numbered sheets. they are
> >> numbered 1, 2, 3, 4 etc. on the first sheet i have two
> >> buttons. i need some coding help with the buttons.
> >> basically i want the first button (called even) to
> print
> >> all the even sheets in the workbook. and the second
> >> button will print the odd sheets in the workbook. also
> i
> >> want different margin settings for each button. the
> even
> >> button will need a left margin of 1 and the odd button
> >> will need a right margin of 2 - while all the other
> >> margins remain 2. i am hoping that this is possible. i
> >> tried recording the marcos but i am not sure how i can
> >> get it to print the evenly and oddly numbered sheets
> (not
> >> pages). thanks in advance.
> >
> >
> >.
> >


0
rondebruin (3789)
7/17/2004 5:47:33 PM
Reply:

Similar Artilces:

Printing Gift Receipt
Happy Thanksgiving! I am attempting to setup the Gift Receipt to print on the same printer as the regular 40 col receipt. So I have the regular receipt printing automatically to OPOS printer 1 and the Gift Receipt setup on OPOS printer 2. Only one printer is physically attached (Epson TM-T88IIIp) Receipt 1 prints fine, After, I answer yes to printer 2 I get this "Invalid operation 425 the printer cannot be accessed it may be locked by another application." So does anyone know a work around so One printer can be printed to as both printer 1 & 2? Thanks, SC Steve, It soun...

Printing a worksheet on 11x17 paper
I want to print a worksheet on 11x17 paper. When I try to change to that paper size in print options, there is no size like that available. What do I do??? thank you for your help in this matter. Katie It's the printer that decides that.. Do you have that option on the printer it should be available in Excel -- Regards, Peo Sjoblom "Katie" <anonymous@discussions.microsoft.com> wrote in message news:9fca01c4345c$bcdca970$a301280a@phx.gbl... > I want to print a worksheet on 11x17 paper. When I try > to change to that paper size in print options, there is ...

Do not Email Button
Folks, can anyone tell me if there is a way to insure that a contact marked as do not email, using the radio button on their record, does not get emailed? thanks Pat No this does not work consistently throughout the system. I believe it has been logged as a bug but no resolution has been provided as far as I am aware. "Phifunk" <Phifunk@discussions.microsoft.com> wrote in message news:DD32EE5B-4BCD-419F-BA5E-FBE7A31843E1@microsoft.com... > Folks, > > can anyone tell me if there is a way to insure that a contact marked as do > not email, using the radio button...

open report default view; is this a setting?
All reports in my application seem to open by default in "fit" view, is hter any way to change that to for example 100% view 1) by changing a setting, 2) by using code? Thxs-Philip Philip: You probably have the report's Autosize property set to Auto. To fix this, follow these steps: 1. Open the report in design view. 2. Open the report's property sheet (View, Properties). 3. Click the Format tab. 4. Change the AutoSize property to "No". Regards Geoff "phleduc" <Ph.Leduc@REMOVEcomcast.net> wrote in message news:%23OXJrjWmHHA.476...

Option Buttons/Radio Buttons
Hi I run Excel 2000 I have 2 option buttons in each row (total of 20 rows) I would like the only one of the 2 buttons in each row are on or off. The problem I am having is that it dosent matter which button on which row I select, only that button is active. All the other buttons go blank. I have tried changing the source for each pair of buttons but when I do all the other button sources change as well. How do i set up the buttons so that I can select one of the 2 in every row.? Example 20 buttons in total - 10 buttons active and 10 buttons inactive Thanks John You have to grou...

Moving a Button in a Dialog
I want to move a button in a dialog window but cannot, below are the steps that I am taking when the user makes the BN_CLICKED command CButton *pBtnOK = (CButton *)GetDlgItem(IDC_BTN) pBtnOK->GetWindowRect( &Rect ) Rect.left += 1 Rect.right += 1 pBtnOK->MoveWindow( &Rect, TRUE) Thanks in advance. Rahvin wrote: > I want to move a button in a dialog window but cannot, below are the steps that I am taking when the user makes the BN_CLICKED command: > > CButton *pBtnOK = (CButton *)GetDlgItem(IDC_BTN); > pBtnOK->GetWindowRect( &Rect ); > Rect.left +...

Settings Button , Customize Button and Service Calendar
Here are the links you can put inside the outlook client to access this menu's inside outlook without having to use the web client to make the changes in your organization Just creat a new folder in the CRM structure ( or not ) , in the properties windows ( homepage ) Insert the following info. Settings http://crm:port/tools/home_tools.aspx?pid=0 System Customization http://crm:port/tools/systemcustomization/systemcustomization.aspx?pid=0 Service Calendar http://crm:port/sm/home_apptbook.aspx You have to creat a folder for each link . Im using this , i dont know if microsoft recommen...

Print statements in Originating Currency #2
Hi, Is there a way to print statements in the originating currency right from GP?. There is a thread here that explains how to do it if you are using Crystal Reports to print statements but we don't do that. Thanks Hi Tara, In the window where you setup your statement criteria, in the Form field, choose either the Multicurrency Blank or Multicurrency Long options. I hope this helps, Eleni "Tara edmoffice" wrote: > Hi, > > Is there a way to print statements in the originating currency right from > GP?. There is a thread here that explains how to do it if ...

printing #11
is there a way to print worksheets in a workbook to different printers and retain the setting? Hi Moe With VBA you can change the activeprinter and print the sheet. And set it back to your default You can change the activeprinter to the printer you want like this Application.ActivePrinter = "hp officejet k series on Ne00:" To know the names of your pinters Change to it in the ctrl P dialog (Cancel after you choose the printer ) and run this so you know the name Sub nameprinter() MsgBox Application.ActivePrinter End Sub If you print with code then look at Printout in the VBA hel...

Print messages (the ones in the utility menu.)
Manager, Utilities, Messages - My employees are not allowed to check their personal e-mail at work. The ability to print the messages would nice. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/...

Printing page number that show on the screen
Windows Vista Home Premium 64-bit, 64-bit Operating system. Publisher is a part of Office 2007 Professional. I have a 16page booklet on 11 by 17 inch paper. 3/8" boundaries. The Master page shows page numbers, but I can't get them to show when printed on 11 by 17 paper on my inkjet printer. They do not show in a PDF prepared for printing at Office Depot. How can I correct this? I suspect your inkjet cannot print that close to the edge or if it is a borderless printer, Publisher is ignoring that fact. What happens if you change the bottom margin to zero when you select the PD...

CD Set
Hi, I have just a very basic question: The CD Set of CRM 3.0, which I received, has only two CDs: 1. CRM Server Setup 2. CRM Outlook Client Setup (Small Business or Professional Edition can be activated) Since CRM 1.2 had 5 CDs and Microsoft never created new applications, which became smaller than previous editions, I just wanted to know, if my CD Set is still complete. Why this edtion seems to be "smaller"? Thanks for your answer. regards Patrick It is complete (as of when CRM 3.0 was launched).. CRM 1.2 included things like the Data Migration Framework and connector to G...

Missing Send Button #3
My kids messed up something in Outlook. I have XP Hmoe and office 2000. My outlook works fine (under my user) but my wife's is now missing the send button in the toolbar. Thus seh cannot send emails. I cannot check the response toolbar under customize. Do I need to uninstall then reinstall or is there a way to fix it without having to do that? Thanks for any help anyone can offer. Is her mail account installed and working? Does reinstalling the account clear up the situation? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. D...

How do you print the last page of an 8 page banner in Publisher?
When I make a large banner, I would like to select a particular page to print. The print preview option allows selection of pages 1,2, etc but does not allow for example only the last page. Print to a PDF... http://www.primopdf.com/ -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "FredSC" <FredSC@discussions.microsoft.com> wrote in message news:78386D22-8473-4EC8-A032-82F802A26C59@microsoft.com... > When I make a large banner, I would like to select a particular page to > print. The print preview option allow...

Printing Charts to Adobe
We are having problems printing charts from Excel (2007) to an Adobe (Acrobat 8) .pdf file. The pdf file is blank. Does anyone know how to get around this? Hi, Not sure how you are going about this but I tried this and it worked: 1. Select the chart 2. Choose Office Button, Save As and from the pop-out choose PDF or XPS The Save As PDF is a free Microsoft Download -- If this helps, please click the Yes button. Cheers, Shane Devenshire "Bern Notice" wrote: > We are having problems printing charts from Excel (2007) to an Adobe (Acrobat > 8) .pdf file. The pdf fil...

Radio Button
I have a form someone created in Excel and somehow three buttons are linked together so that if I click on one, it selects the one I click on and clears one selected before. Is there a way to have it clear the button that was selected if I click on the same button again. As it is, I cannot clear all the buttons once a button is selected. Hi This is what radiobuttons (option buttons) are for. Either Male or Female, no None or Both or Not sure yet or Refuse to answer. For independent choices (Vegetarian, Blonde, Plays guitar, ... ) use checkboxes. HTH. Best wishes Harald "Debb...

LABEL PRINTING PROBLEM
Each time the print labels wizard completes the label 'print previews' and I have to select either the page properties or print properties so the labels view and print properly. I am not changing anything when I select either one of the properties but this corrects the view. Is there a fix for this error because this only affects page one of the print job because if I view any other page it views just fine. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I A...

problems with window.print() in CRM
Hello, We have a problem where the Window.print() command does not work from custom forms that are hosted from the isv.config file,After clicking the print button on the print dialog box, it displays the print icon on the internet explorer status bar, but does not send the output to the printer. Any ideas? ...

Buttons Issue with Access 2007 on Vista
Hi there! I have a client who has a simple access DB. If he runs it onXP/Access 2007 no issue, but if he runs it on vista/access2007, he can't click any of the buttons on any of theforms! Could someone shed some light please?...

Can administrative rights be over a certain OU and only that OU?
Hi, I have user who needs to administer the Exchange tasks of a particular OU group and only that OU. Is it possible to grant Exchange 2003 rights to an Active Directory user on only one OU? The user alreayd has rights over the OU to change the AD password and various account items. They just need Exchange 2003 tasks added. I don't want that user to have the right to change everyone's Exchange settings, just his group. Thank you for any help. You have to grant Exchange rights to that user and apply those on your Exchange org. You would start by giving View Only rights to the ap...

Outlook Custom Button
Hi All, Is there a way to add a custom button to Outlook 2003 SP-2 standard tool bar and have it replicate to all the users in the domain? Thanks CG You'd need to add it using a script or vba and push it out via a logon script. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook 2007: http://www.slipstick.com/outlook/ol2007/ Outlook Tips by email: dailytips-subscribe-request@lists.outlooktips.net Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Cen...

Credit Card Receipt will Not Print After Changing CC Processor
We are running RMS 1.3 and recently changed from Mercury Payment Systems to Heartland Payments. We were running 3rd party software call TPI, but are now running directly through RMS EDC. Everything is working fine except now the credit card signature receipt does not print. All of the fields are properly selected in the Tender Type. Any suggestions? -- Mike Hofer You should have stayed with Mercury! :o) TPI uses their own receipt format, therefore, you must redirect the receipt format to point to the default receipt in RMS. -- Teresa "Mike Hofer" wrote: > We are ru...

How do I set an 'M' prefix to existing text in a column?
Hi I have a column of part numbers which are of varying length and start with varying letters. I would like to add 'M' to the beginning of every cell so for example A2115401717 would become MA2115401717. I'm fairly new to excel so I'm not sure if this is even possible. I would appreciate any help. Assuming your column A, type in B ="M"&A2 and copy down. Regards Cimjet "muppetlover27" <muppetlover27@discussions.microsoft.com> wrote in message news:4AC9F6EA-BE8E-4A58-AE1B-F91F0824AB5C@microsoft.com... > Hi > I have a column of part numbe...

Publisher-prints every other line darker.
When printing out a publication on Publisher every other line is darker as if the bold were turned on. Checked printer no problem there. If this is a feature of Publisher is there a way to turn it off. Any suggestions will be appreciated Have you checked the settings? Maybe they are different line weights - or could there be more than one line on top of one another? -- JoAnn Paules MVP Microsoft [Publisher] "Keystone Kid" <Keystone Kid@discussions.microsoft.com> wrote in message news:E8472C79-C6ED-4888-8EDA-FE0C97779787@microsoft.com... > When printing out a pu...

Superscript Button and Subscript Button
I am trying to customize my toolbars, and I can't seem to find the superscript or subscript command. Is there a way to make the superscript and subscript commands into a button in Excel? "=?Utf-8?B?U2xvdGg=?=" <Sloth@discussions.microsoft.com> wrote in news:3D6FC2A9-56DD-49DD-B2A3-0DC028A12184@microsoft.com: > I am trying to customize my toolbars, and I can't seem to find the > superscript or subscript command. Is there a way to make the > superscript and subscript commands into a button in Excel? > Record a macro for each and tie them to buttons. ...