LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Revised btnprint1_click()

yesterday, I posted a similar routine where I was trying
to pass along a control option to a print range, so that I
could print selected reports based on selecting a print
range that was passed along from this procedure.

I was seeking help with that, but I think I've figured out
another route that I still need help with.

I have five options on a frame with the default option
being the print all ranges. Someone suggested before I did
the following cases that the caption in this script had to
be a valid range name, but I didn't want to name them that
way. So, I devised this attempt at using cases to name the
print range based on the caption I listed in these cases.

Where it appears to hang now when I step through it is in
the line: Range(Printthisrange).Select

As far as I could tell, if "Printhisrange" were defined as
a range, then shouldn't I be able to pass along a name to
that variable based on my cases here. And then when the
cases selected the value of "printthisrange", shouldn't I
be able to pass that along to the line listed above?

And then once I've solved that mystery, really what I need
to do is provide for the "Print All OBA Pages" case in
which I need to select all four previous ranges for the
print.

I'm still very much a newbie at Visual Basic, but I think
I'm learning quickly.

Private Sub btnprint1_Click()
Dim myOption As Control
Dim Printoption
Dim Printthisrange As Range
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PaperSize = xlPaperLegal
.FitToPagesWide = 1
.FitToPagesTall = 1
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

For Each myOption In Frame1.Controls
If myOption.Value = True Then
Printoption = myOption.Caption
End If
Next myOption

Select Case Selectprnrange
Case 1
Printoption = "Cantera Natural Gas"
Printthisrange = "OBACGG"
Case 2
Printoption = "DEFS"
Printthisrange = "OBADEFS"
Case 3
Printoption = "Agave"
Printthisrange = "OBAAgave"
Case 4
Printoption = "TWML"
Printthisrange = "OBATWML"
Case 5
Printoption = "Print All OBA Pages"


End Select



Unload Me
Range(Printthisrange).Select
Selection.PrintPreview
Range("a1").Select


End Sub
 
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
revised q on report from tables UKMAN Excel Worksheet Functions 7 April 20th 10 04:15 PM
3rd and last Revised WorkBook Aussiegirlone Excel Discussion (Misc queries) 3 June 21st 09 07:02 PM
REVISED Nexted IF and Countif LPS Excel Worksheet Functions 3 December 5th 07 07:53 PM
Adding in Excel Revised cb New Users to Excel 9 October 8th 07 06:25 AM
n or U Revised ? Blessingspoint Excel Worksheet Functions 1 January 18th 05 08:43 PM


All times are GMT +1. The time now is 01:13 PM.

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

About Us

"It's about Microsoft Excel"