LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Setting form caption based on global variable

I have created a file menu that acts as a way for users to easily create
standard reports. All of the reports need the same initial information to
begin (i.e. which periods to compare).

What I want to happen:

1) When a user chooses the report from the file menu I want to create a
global variable based on the selection. I thought I could capture this with
the following.
.OnAction = "'Create_Reports_Start""" & .Caption & """'"
This refers to the following sub:
Sub Create_Reports_Start(ReportName)
Application.StatusBar = "Creating report: " & ReportName
Form_Reports.Show
End Sub

2) I have declared ReportName globally with the following:
Global ReportName As Long

3) When Form_Reports has been filled out then I would like the following to
run upon pressing the "Create" button, using the 'Select Case' to call the
desired report.
Private Sub Button_Create_Click()
Dim Year1, Year2 As Long
Year1 = Box_Year1.Value
Year2 = Box_Year2.Value
Application.ScreenUpdating = False
Select Case ReportName
Case "Events by Level" '<< code stops here with a mismatch error
Call Create_Report_EventByLevel(Year1, Year2)
'Continue with the rest of the reports...
End Select
Unload Form_Reports
End Sub


The global ReportName variable seems to work some of the time and not other
times. It places the text in the status bar, but when form_Reports loads it
does not place ReportName in the caption of the form (this is in the
User_Form_Initialize code).

I would greatly appreciate any ideas either to fix what I've got or better
suggestions.

--
JNW
 
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
Setting a Custom Class as a Global variable Xiazer[_15_] Excel Programming 3 May 31st 06 11:52 AM
Call Event and Load Form based on Variable Resant Excel Programming 4 March 15th 06 02:08 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
Form Controls; setting properties based on cell values Glenn Ray[_3_] Excel Programming 4 April 17th 05 04:33 AM
Excel Global Variable Setting John Baker Excel Programming 8 November 25th 03 02:34 PM


All times are GMT +1. The time now is 06:46 AM.

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"