Turn a finished calibration into a script sheet, then refresh its signal column from VBA or a button on the sheet.
Running from a macro
A macro names a script sheet; AlphaGen runs that calibration again on today's data and refreshes its intensity column, even with the pane closed. Windows and Mac only - Excel on the web cannot run VBA. There is nothing to switch on.
Menu → Macros shows the same five steps as below, and ticks each one off once it sees it done.
1. Connect
Paste your API token in the pane, as on the Excel add-in page.
2. Create the script sheet
On the results of a run, under Use this signal:
- Choose the column - select one column, then press Use selection.
- Write the intensity - optional, but lets you check the column first.
- Press Create script sheet.
That adds an AG Script <n> sheet holding every range and parameter of the run - readable and
editable - plus the AG Control sheet the macro talks through. The pane then opens Macros.
Create script sheet only works for the run your current setup produced. For an older run opened from History, set it up again with New calibration and run it.
3. Save the workbook as .xlsm
File → Save As → Excel Macro-Enabled Workbook (*.xlsm). A plain .xlsx drops macros silently.
4. Add the VBA module, and test it
- Show the Developer tab - Windows: File → Options → Customize Ribbon → Developer; Mac: Excel → Preferences → Ribbon & Toolbar → Developer.
- Menu → Macros, press Copy VBA module.
- Open the VBA editor (Windows:
Alt+F11; Mac: Tools → Macro → Visual Basic Editor), choose Insert → Module and paste. Do not edit it. - Test it: Developer → Macros → AlphaGenCheck → Run. It runs no calibration and costs nothing. A message box says whether AlphaGen is ready.
5. Put it on a button
- On Macros, under Script sheets, press Copy button macro. It copies a ready-made
macro, e.g.
Refresh_AG_Script_1. - In the VBA editor, Insert → Module to make a module of your own, and paste it there - not into the AlphaGen module.
- Developer → Insert → Button (Form Control), and drag it onto the sheet.
- In the Assign Macro dialog, pick
Refresh_AG_Script_1and press OK. - Click it. A run takes a few minutes. The status bar shows it is working, and a message box says when the column is refreshed.
The VBA calls
| Call | Does |
|---|---|
AlphaGenRun(sheet, [timeoutSeconds]) | Submits and waits (30 minutes by default); returns once the column is refreshed |
AlphaGenSubmit(sheet) | Submits and returns a request id without waiting |
AlphaGenStatus(id) | waiting, running, done, error, blocked, interrupted or missing |
AlphaGenMessage(id) | What AlphaGen wrote back about that request |
AlphaGenCheck() | Round-trip test; spends no calibration |
A button can only run an argument-less Sub, which is why Copy button macro wraps
AlphaGenRun in one.
Watching requests
Menu → Macros → Recent requests shows the last few and what happened to them;
Show sheet opens AG Control.
| Status | Means |
|---|---|
Stays waiting | The add-in is not loaded in this Excel session. Open the pane once. |
blocked | No API token on this computer. Connect in the pane. |
Another instrument
Duplicate an AG Script <n> sheet, change its Sheet, Columns and output Column cells,
and name it in another call. Requests queue and run one at a time.
Sub MorningRefresh()
AlphaGenRun "AG Script TTF"
AlphaGenRun "AG Script JKM"
End Sub
Was this article helpful?