I have a form that prompts the user to continue or cancel. If they select the wrong file I cancel and want to give a message and restart. I need to check myFileStatus As Boolean but it is empty when I return to Public Sub OKButton_Click(). Your help is appreciated.
Tom
Tom
Code:
[COLOR=#0000cd]' located in RESPONSE.xlsm - UpdateForm (code) OKButton - click[/COLOR]
Public Sub OKButton_Click()
Dim msg As String
ThisWorkbook.Activate
Call Sheet1.update_trackingFile
Unload UpdateForm
Debug.Print myFileStatus ' trying to get status so I can cancel message with an If... then
msg = " Your emails have been sent" & vbNewLine
msg = msg & " confirm in CP sent folder"
MsgBox msg
End Sub
'================================================================================
[COLOR=#0000cd]' This is located in RESPONSE.xlsm -Sheet1(code) General - update_trackingFile[/COLOR]
' Right click any cell to start the process of emailing responses to signup requests.
Public mailcount As Long ' number of emails sent
Dim RosterFileName As Variant
Dim ResponseFileName As Workbook
Dim mylocalpath As Variant
Dim MyActivefile As Variant
Const emailColumn As String = "C" ' column in response file for e-mail address
Dim lastRow As Long
[COLOR=#ff0000] Public myFileStatus As Boolean ' I'm trying to use this in another subroutine[/COLOR]
Dim fullpath As Variant
___________________________________________________________________________________________
Public Sub update_trackingFile()
' Routing to take responses from a google form's spreadsheet. It will also email a response to
' the requester's email
' makes sure the Roster file is open
mylocalpath = ThisWorkbook.Path
MyActivefile = ThisWorkbook.FullName
Set ResponseFileName = ThisWorkbook
ResponseFileName.Activate
With Sheet1
' confirm that the roster file is open and the version you want
Call OfferRosterFile
If myFileStatus = False Then
Exit Sub
Else
End If
' Insert the email address in the response file
Call insertEmail
' send an email to all that have responded
Call Send_emails '****** send to must be adjusted before release
End With
End Sub
...
...
...
If Not UCase(RosterFileName) Like FilterName Then
MsgBox "You must Select a Roster file"
myFileStatus = False
Exit Sub