Hello, in ThisWorkbook, when the workbook opens, it declares some variables public, and then subsequently assigns values to these variables.
In a subsequent module that requires the values of these public variables, the values are non-existent.
Can anyone please advise where I am going wrong?
THISWORKBOOK CODE
In a subsequent module that requires the values of these public variables, the values are non-existent.
Can anyone please advise where I am going wrong?
THISWORKBOOK CODE
MODULE CODEOption Explicit
Public strMasterDBPath As String
Public strDBFileName As String
Public conBase As ADODB.Connection
Public Sub Workbook_Open()
ThisWorkbook.Activate 'temporary for ease of restarting the workbook
'create public variables:
strMasterDBPath = ThisWorkbook.Path
strDBFileName = "Master_Database.mdb"
.
.
.
Option Explicit
Public Const MODULE_NAME As String = "Util_Import_Master"
Sub Fetch_Master_Data()
Dim strFullPath, strPath, strMsg As String
Dim objAccess_Master As Access.Application
' Description:-
' This process takes the required data from the Master DB on the network drive
' and loads it into the Excel workbook.
strFullPath = strMasterDBPath + strDBFileName <<<< ERROR: All string variables empty
Application.DisplayAlerts = False
Set objAccess_Master = CreateObject(strFullPath)
.
.
.