Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Making a Custom Dialog Box Work (some code included)

When I open a spreadsheet I immediately want a dialog box to appear asking
the user for the following information:
Name
Center
Month
Week
Then I want to take that data and assign it to particular cells in the
sheet. I have created a dialog box (NotSoFast) that includes four comboboxes
(Name, Center, Month, Week) and a button (Panic Switch). I just don't know
how to put it altogether to make it work. Here is the following code I have
written so far:

Public NameSelect As String
Public CenterSelect As String
Public MonthSelect As String
Public WeekSelect As String

Sub ShowNotSoFast()
'I have nothing here so far. Not sure if I even need it :(
End Sub

Private Sub Name_Change()
With NotSoFast.Name
.AddItem "Jack"
.AddItem "John"
.AddItem "Sara"
.AddItem "Mike"
End With
End Sub

Private Sub Center_Change()
With NotSoFast.Center
.AddItem "NYC"
.AddItem "Las Vegas"
.AddItem "Canada"
.AddItem "Grace Land"
End With
End Sub

Private Sub Month_Change()
With NotSoFast.Month
.AddItem "January"
.AddItem "February"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "July"
.AddItem "August"
.AddItem "September"
.AddItem "October"
.AddItem "November"
.AddItem "December"
End With
End Sub

Private Sub Week_Change()
With NotSoFast.Week
.AddItem "Week 1"
.AddItem "Week 2"
.AddItem "Week 3"
.AddItem "Week 4"
.AddItem "Week 5"
End With
End Sub

Private Sub PanicSwitch_Click()
MonthSelect = Month.Value
WeekSelect = Week.Value
NameSelect = Name.Value
CenterSelect = Center.Value
Cells(1, 1) = MonthSelect
Cells(2, 1) = WeekSelect
Cells(1, 2) = NameSelect
Cells(2, 2) = CenterSelect
End Sub

How do I make my dialog box open when the spreadsheet is opened so the user
can select the appropriate info from the comboboxes and click "panic switch"
to make the info populate the designated cells?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Making a Custom Dialog Box Work (some code included)

you can automatically run code when a workbook opens in two ways

1) Use the workbook's OPEN event
2) create a procedure (macro) called Auto_Open

they would both need this one line of code

notSoFast.Show

"Bishop" wrote:

When I open a spreadsheet I immediately want a dialog box to appear asking
the user for the following information:
Name
Center
Month
Week
Then I want to take that data and assign it to particular cells in the
sheet. I have created a dialog box (NotSoFast) that includes four comboboxes
(Name, Center, Month, Week) and a button (Panic Switch). I just don't know
how to put it altogether to make it work. Here is the following code I have
written so far:

Public NameSelect As String
Public CenterSelect As String
Public MonthSelect As String
Public WeekSelect As String

Sub ShowNotSoFast()
'I have nothing here so far. Not sure if I even need it :(
End Sub

Private Sub Name_Change()
With NotSoFast.Name
.AddItem "Jack"
.AddItem "John"
.AddItem "Sara"
.AddItem "Mike"
End With
End Sub

Private Sub Center_Change()
With NotSoFast.Center
.AddItem "NYC"
.AddItem "Las Vegas"
.AddItem "Canada"
.AddItem "Grace Land"
End With
End Sub

Private Sub Month_Change()
With NotSoFast.Month
.AddItem "January"
.AddItem "February"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "July"
.AddItem "August"
.AddItem "September"
.AddItem "October"
.AddItem "November"
.AddItem "December"
End With
End Sub

Private Sub Week_Change()
With NotSoFast.Week
.AddItem "Week 1"
.AddItem "Week 2"
.AddItem "Week 3"
.AddItem "Week 4"
.AddItem "Week 5"
End With
End Sub

Private Sub PanicSwitch_Click()
MonthSelect = Month.Value
WeekSelect = Week.Value
NameSelect = Name.Value
CenterSelect = Center.Value
Cells(1, 1) = MonthSelect
Cells(2, 1) = WeekSelect
Cells(1, 2) = NameSelect
Cells(2, 2) = CenterSelect
End Sub

How do I make my dialog box open when the spreadsheet is opened so the user
can select the appropriate info from the comboboxes and click "panic switch"
to make the info populate the designated cells?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Making a Custom Dialog Box Work (some code included)

Patrick

Thanks. That answered part of my question. The NotSoFast dialog box
appears when I open the workbook now. But none of my drop-down lists work.
Are they coded wrong? Do I need to put them somewhere specific?

"Patrick Molloy" wrote:

you can automatically run code when a workbook opens in two ways

1) Use the workbook's OPEN event
2) create a procedure (macro) called Auto_Open

they would both need this one line of code

notSoFast.Show

"Bishop" wrote:

When I open a spreadsheet I immediately want a dialog box to appear asking
the user for the following information:
Name
Center
Month
Week
Then I want to take that data and assign it to particular cells in the
sheet. I have created a dialog box (NotSoFast) that includes four comboboxes
(Name, Center, Month, Week) and a button (Panic Switch). I just don't know
how to put it altogether to make it work. Here is the following code I have
written so far:

Public NameSelect As String
Public CenterSelect As String
Public MonthSelect As String
Public WeekSelect As String

Sub ShowNotSoFast()
'I have nothing here so far. Not sure if I even need it :(
End Sub

Private Sub Name_Change()
With NotSoFast.Name
.AddItem "Jack"
.AddItem "John"
.AddItem "Sara"
.AddItem "Mike"
End With
End Sub

Private Sub Center_Change()
With NotSoFast.Center
.AddItem "NYC"
.AddItem "Las Vegas"
.AddItem "Canada"
.AddItem "Grace Land"
End With
End Sub

Private Sub Month_Change()
With NotSoFast.Month
.AddItem "January"
.AddItem "February"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "July"
.AddItem "August"
.AddItem "September"
.AddItem "October"
.AddItem "November"
.AddItem "December"
End With
End Sub

Private Sub Week_Change()
With NotSoFast.Week
.AddItem "Week 1"
.AddItem "Week 2"
.AddItem "Week 3"
.AddItem "Week 4"
.AddItem "Week 5"
End With
End Sub

Private Sub PanicSwitch_Click()
MonthSelect = Month.Value
WeekSelect = Week.Value
NameSelect = Name.Value
CenterSelect = Center.Value
Cells(1, 1) = MonthSelect
Cells(2, 1) = WeekSelect
Cells(1, 2) = NameSelect
Cells(2, 2) = CenterSelect
End Sub

How do I make my dialog box open when the spreadsheet is opened so the user
can select the appropriate info from the comboboxes and click "panic switch"
to make the info populate the designated cells?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Making a Custom Dialog Box Work (some code included)

in the code behind the form, add a sub for popuating the list boxes. Call
this from the form's load event. don't know why you're using the change event
....thats the wrong place IMHO



"Bishop" wrote:

Patrick

Thanks. That answered part of my question. The NotSoFast dialog box
appears when I open the workbook now. But none of my drop-down lists work.
Are they coded wrong? Do I need to put them somewhere specific?

"Patrick Molloy" wrote:

you can automatically run code when a workbook opens in two ways

1) Use the workbook's OPEN event
2) create a procedure (macro) called Auto_Open

they would both need this one line of code

notSoFast.Show

"Bishop" wrote:

When I open a spreadsheet I immediately want a dialog box to appear asking
the user for the following information:
Name
Center
Month
Week
Then I want to take that data and assign it to particular cells in the
sheet. I have created a dialog box (NotSoFast) that includes four comboboxes
(Name, Center, Month, Week) and a button (Panic Switch). I just don't know
how to put it altogether to make it work. Here is the following code I have
written so far:

Public NameSelect As String
Public CenterSelect As String
Public MonthSelect As String
Public WeekSelect As String

Sub ShowNotSoFast()
'I have nothing here so far. Not sure if I even need it :(
End Sub

Private Sub Name_Change()
With NotSoFast.Name
.AddItem "Jack"
.AddItem "John"
.AddItem "Sara"
.AddItem "Mike"
End With
End Sub

Private Sub Center_Change()
With NotSoFast.Center
.AddItem "NYC"
.AddItem "Las Vegas"
.AddItem "Canada"
.AddItem "Grace Land"
End With
End Sub

Private Sub Month_Change()
With NotSoFast.Month
.AddItem "January"
.AddItem "February"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "July"
.AddItem "August"
.AddItem "September"
.AddItem "October"
.AddItem "November"
.AddItem "December"
End With
End Sub

Private Sub Week_Change()
With NotSoFast.Week
.AddItem "Week 1"
.AddItem "Week 2"
.AddItem "Week 3"
.AddItem "Week 4"
.AddItem "Week 5"
End With
End Sub

Private Sub PanicSwitch_Click()
MonthSelect = Month.Value
WeekSelect = Week.Value
NameSelect = Name.Value
CenterSelect = Center.Value
Cells(1, 1) = MonthSelect
Cells(2, 1) = WeekSelect
Cells(1, 2) = NameSelect
Cells(2, 2) = CenterSelect
End Sub

How do I make my dialog box open when the spreadsheet is opened so the user
can select the appropriate info from the comboboxes and click "panic switch"
to make the info populate the designated cells?

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
Effect of "Save As..." in making VBA code work, or not David J Richardson[_2_] Excel Programming 0 October 24th 07 12:03 PM
Userform questions -- code included! Ray Excel Programming 4 August 6th 07 02:16 PM
Making VBA code from one WB work on another WB ForestRamsey Excel Programming 2 December 6th 05 05:39 PM
Run-time error '9' ---- Code to fix included. [email protected] Excel Programming 3 September 2nd 05 02:48 PM
VBA code to show a save as dialog does not work Kevin Excel Programming 4 November 17th 03 08:36 AM


All times are GMT +1. The time now is 03:24 PM.

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"