DefinitelyTyped/types/activex-access/activex-access-tests.ts
Zev Spitz 73dd199e0f Microsoft Office (Desktop) via Automation (#19987)
* Merge updates (#4)

* Merge upstream updates (#5)

* Initial commit for MS OFfice Automation

* Modified activex-excel and tests; activex-msforms

* ADODB tests, DAO tests

* msforms, msxml, mshtml

* MSXML tests

* Office, VBIDE, Word

* Word

* Word

* Outlook, Powerpoint

* Added project URL for stdole

* Added 'private' to package.json

* activex-adodb fixes

* remove public member-access

* activex-adodb fixes

* activex-adodb tests fixes

* activex-adodb-tests fix

* activex-adodb-tests fix -- no-unnecessary-generics

* remove public modifier

* TravisCI fixes

* More TravisCI fixes

* More TravisCI fixes
2017-09-25 12:32:34 -07:00

26 lines
776 B
TypeScript

let app = new ActiveXObject('Access.Application');
app.UserControl = true;
// opens a form
app.DoCmd.OpenForm('MyForm', Access.AcFormView.acNormal, '', 'LastName="Smith"');
// change the contents of a textbox
// tslint:disable-next-line:no-unnecessary-type-assertion
let textbox = app.Forms.Item('MyForm').Controls.Item('MyTextBox') as Access.TextBox;
textbox.Text = 'Not Smith';
// save the current record on the active form
app.RunCommand(Access.AcCommand.acCmdSaveRecord);
// close the form
app.DoCmd.Close(Access.AcObjectType.acForm, 'MyForm');
// open a report for printing
app.DoCmd.OpenReport('MyReport');
// open the same report in Design View
app.DoCmd.OpenReport('MyReport', Access.AcView.acViewDesign);
// run a VBA macro
app.Run('MyMacro', 'argument1', 2);