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: 360
Default scope of public variables

I wonder why the frRptDate and the toRptDate variables never show the values
in the message box? This macro is an option button on a form. I have
defined these variables as public variables in a previous module that calls
the form and I did a debug. print statement to see that the variables are
getting set with the value. Just when the user clicks the form I would like
a msgbox with the date of the report so the scope of the variables should be
for the entire project right? Correct me if I am wrong.
-----Form macro that has msg box with dates--------

Sub optCkforDupes_Click()
Dim nResult As Long
Debug.Print frRptDate
Debug.Print toRptDate
Fprocess1 = False

If optCkforDupes.Value = True Then
nResult = MsgBox(prompt:="From: " & frRptDate & vbNewLine & "To: " &
toRptDate, Buttons:=bvOKCancel, Title:="report Date")

End If
If nResult = vbOK Then
Call createXLdb.CkforDupes
Fprocess1 = True
End If

End Sub
Its always cell A1 & B1 that has the dates. They have to be removed since
it is a database spreadsheet.
----------the module that calls the form------

Option Explicit
Public FrReptDate As Date
Public ToReptDate As Date
--

Public Sub LoadProcessChoices()
On Error GoTo ERR_Message
openFile
deleteDateRow1
ProcessChoices.Show
End Sub
------
Private Sub openFile()

Const fName As String = "Book1.xls"
Const fPath As String = "Mac OS X:SSP Process:"

Dim wkb As Workbook
On Error Resume Next

Set wkb = Workbooks(fName)
On Error GoTo 0
If wkb Is Nothing Then _
Set wkb = Workbooks.Open(Filename:=fPath & fName)

End Sub
-----

Sub deleteDateRow1()
Dim Rng As Range
Set Rng = Range("A1")
With Rng
If IsDate(.Value) Then
FrReptDate = .Value
ToReptDate = .Offset(0, 1).Value

..EntireRow.Delete Shift:=xlUp
Debug.Print FrReptDate
Debug.Print ToReptDate

Else
Exit Sub
End If
End With
End Sub


THANKS,

 
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
Scope of Variables leerem Excel Discussion (Misc queries) 4 September 30th 08 12:54 PM
Public variables and scope Dennis Benjamin Excel Programming 3 December 2nd 05 04:41 AM
Scope of variables Purnima Excel Programming 1 April 5th 05 05:59 AM
Scope of a public variable Jos Vens Excel Programming 0 November 24th 03 10:08 AM
Scope of Public Variable Dkline[_2_] Excel Programming 9 October 22nd 03 04:53 PM


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