Recording Data File Selections
The recording of the Master Macro begins when you select Start Recording Log of Analyses (Master Macro) from the Tools - Macro menu. If you select an input data file after you start the recording, then the selection of that file will become part of the Master Macro. For example, suppose you open a data file and then start a Multiple Regression analysis; the recorded macro will include the following lines:
Dim S1 As Spreadsheet
Set S1 = Spreadsheets.Open ("c:\datasets\OilAnalysis.sta")
S1.Visible = True
Dim newanalysis2 As Analysis
Set newanalysis2 = Analysis (scMultipleRegression,S1)
The input data file selection was explicitly recorded, and the Multiple Regression was initialized using the data file that was explicitly opened for this analysis. Hence, if you run this Master Macro, the analysis will be performed on the same data file, i.e., it will be loaded from the disk prior to the Multiple Regression analysis.
Now suppose you start the recording of the Master Macro after you have already selected and opened an input data file. The same analysis might be recorded like this.
Dim S1 As Spreadsheet
Set S1 = ActiveSpreadsheet
Dim newanalysis2 As Analysis
Set newanalysis2 = Analysis (scMultipleRegression,S1)
Now the recording started by defining as the input data file the currently active input spreadsheet. If you run this Master Macro, the Multiple Regression analysis will be performed on the currently active input data file, i.e., possibly a different data file than that used while recording the Master Macro.