Search notes:

Examples for VBScript MS-Office App Creator: Access (simple)

This is one of the examples for the command line Office App Creator.
This example creates an Access database (named created.accdb) and inserts a VBA module, functions.bas (see below), into the database.

functions.bas

This is the module that is inserted into the database. Its sub main is called after the database is created.
option explicit

sub main(projectRootDir as string) ' {

    msgBox "main, projectRootDir = " & projectRootDir

end sub ' }
Github repository VBS-MS-Office-App-Creator, path: /examples/Access/simple/functions.bas

create.wsf

This is the VBScript file that creates the Access Database (createOfficeApp()), inserts the module insertMOdule() and finally calls main(), using the run method that is defined in the Access Application object.
<job>
<script language="VBScript" src="..\..\..\create-MS-Office-app.vbs" />

<script language="VBScript">

   option explicit

   dim app
   set app = createOfficeApp("access", currentDir() & "created.accdb")

   '
   '  Insert a module. The 3rd parameter (1) indicates a «normal» module (vbext_ct_StdModule).
   ' (2, = vbext_ct_ClassModule, inserts a class).
   '
   insertModule app, currentDir() & "functions.bas", "funcs", 1

   '
   '  Run the function main.
   '
   app.run "main", currentDir()

   '
   '  Apparently, it not necessary to save an MS-Access «document».
   '

   wscript.echo "The end"

</script>
</job>
Github repository VBS-MS-Office-App-Creator, path: /examples/Access/simple/create.wsf

See also

VBScript MS-Office App Creator

Index