Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Custom made dialog box

Hi
I am trying to create a dialog box that comes up with radio buttons or check boxes to print certain print areas, they click on one, and up comes that chosen print area for preview before printing. Can someone help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Custom made dialog box

Deeds,

Here is a previous post of my that creates a custom dialog box for
worksheets. Adapt to suit

Sub SelectSheets()
Dim i As Integer
Dim TopPos As Integer
Dim iBooks As Integer
Dim PrintDlg As DialogSheet
Dim CurrentSheet As Worksheet
Dim cb As CheckBox
Application.ScreenUpdating = False

' Check for protected workbook
If ActiveWorkbook.ProtectStructure Then
MsgBox "Workbook is protected.", vbCritical
Exit Sub
End If

' Add a temporary dialog sheet
Set CurrentSheet = ActiveSheet
Set PrintDlg = ActiveWorkbook.DialogSheets.Add

iBooks = 0

' Add the checkboxes
TopPos = 40
With ActiveWorkbook
For i = 1 To .Sheets.Count
If .Sheets(i).Name < PrintDlg.Name Then
Set CurrentSheet = .Sheets(i)
' Skip empty sheets and hidden sheets
iBooks = iBooks + 1
PrintDlg.CheckBoxes.Add 78, TopPos, 150, 16.5
PrintDlg.CheckBoxes(iBooks).Text = _
Sheets(i).Name
TopPos = TopPos + 13
End If
Next i
End With

' Move the OK and Cancel buttons
PrintDlg.Buttons.Left = 240

' Reactivate original sheet
CurrentSheet.Activate
PrintDlg.Visible = False

' Set dialog height, width, and caption
With PrintDlg.DialogFrame
.Height = Application.Max _
(68, PrintDlg.DialogFrame.Top + TopPos - 34)
.Width = 230
.Caption = "Select sheets to process"
End With

' Change tab order of OK and Cancel buttons
' so the 1st option button will have the focus
PrintDlg.Buttons("Button 2").BringToFront
PrintDlg.Buttons("Button 3").BringToFront

' Display the dialog box
Application.ScreenUpdating = True
If PrintDlg.Show Then
For Each cb In PrintDlg.CheckBoxes
If cb.Value = xlOn Then
MsgBox Sheets(cb.Caption).Name & " selected"
End If
Next cb
Else
MsgBox "Nothing selected"
End If

' Delete temporary dialog sheet (without a warning)
Application.DisplayAlerts = False
PrintDlg.Delete

End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Deeds" wrote in message
...
Hi,
I am trying to create a dialog box that comes up with radio buttons or

check boxes to print certain print areas, they click on one, and up comes
that chosen print area for preview before printing. Can someone help?


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
Display a Custom Dialog Box BHatMJ Excel Discussion (Misc queries) 3 May 21st 08 09:24 AM
How to save a custom made header&footer HeintjeHB Excel Discussion (Misc queries) 3 June 29th 06 04:25 PM
Custom made default scatter plot only works for one session JustBob Charts and Charting in Excel 0 May 3rd 06 07:39 PM
Custom View Dialog Box GLT Excel Discussion (Misc queries) 0 November 13th 05 03:20 PM
AutoFilter Custom Dialog AlexJ Excel Programming 1 February 27th 04 01:12 PM


All times are GMT +1. The time now is 02:42 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"