Hi All & Brian,
I have a doubt regarding declaring a variable in one macro script and then using the variable's value defined by the end user in the first macro in the second macro. To give you more perspective this is the code i am working on:
Global sFilename As String
( The variable sFilename then will contain the name of the database selected by the user, it was taken from your field mapping script template )
Call TopNExtraction() 'sFilename is the variable database name
Call ExportDatabaseXLSX() 'KPI 1.IMD
' Data: Top Records Extraction
Set db = Client.OpenDatabase(sFilename) ' I get get an error code here, saying the database was not found or is in use.
Set task = db.TopRecordsExtraction
Dim dbName As String ' Made an addition while using sFilename as a variable
task.AddKey "CREDIT", "A"
dbName = "KPI 1.IMD"
task.OutputFileName = dbName
task.NumberOfRecordsToExtract = 30
task.CreateVirtualDatabase = False
Set task = Nothing
Set db = Nothing
My end goal is that the after the user selects the database and maps the neccesary fields in the dialogue box, the 2nd Macro which has the actual analysis to be run, then selects that database from the variable defined in the 1st Macro i.e. sFilename.Please help me here, i am stuck.
Last seen: 10 months 3 weeks ago
Joined: 01/09/2018 - 14:02