0

Good Day

I did create a Global variable in my Script. It does keep the variable itself over Module correctly, but it doesn't keep the contain of the variable. Is there a way to keep its contain?

I've tried with

Set ProcessFileName = ActiveWorkbook.Name

But this line return me an error.

I did try with both Global and Public.

My code :

Option Explicit
Global FirstDay As Boolean
Global ProdPreviousFileName  As String
Global WMsgBox As Integer
Global PreviousDate As String
Global PreviousFile As String
Public ProcessFileName As String

Sub Auto_Open()

ProcessFileName = ActiveWorkbook.Name 'This is the Variable I want to keep the contain

Sheets("GENERAL INFORMATION").Select Range("A1").Select

WMsgBox = MsgBox("Start Compliancy Report Building ?", vbQuestion + vbYesNo)

If WMsgBox = vbYes Then WMsgBox = MsgBox("Is is the first business day of the week ?", vbQuestion + vbYesNo) If WMsgBox = vbYes Then FirstDay = True PreviousFile = Application.GetOpenFilename( _ Title:="Select previous available Compliancy Report") Call Module1.DEFINE_PROD_VARIABLES

Else
FirstDay = False
    PreviousFile = Application.GetOpenFilename( _
    Title:="Select previous available Compliancy Report")
Call Module1.DEFINE_PROD_VARIABLES
End If

Else End If End Sub

harrymc
  • 498,455

0 Answers0