Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: VBScript Excel AddIn API
From VBS (VBScript), it is possible to call a Windows API indirectly via Excel app and one of its add-in function, CALL(), see for details the Office/Excel online help and the following MS webpage on CALL usage:
Following VBS code shows an example that obtains some information by making an indirect call to a Win API function, GetTickCount():
dim tmTicks
set xlApp = CreateObject("Excel.Application")
tmTicks = xlApp.ExecuteExcel4Macro("CALL(""Kernel32"",""GetTickCount"",""J"")")
Wscript.echo "Obtained tmTicks = " & tmTicks
set xlApp = nothing
This call is simple in that it passes in simple (-typed) args (/values) only, but I wonder how to call an API function that take more complicated arguments, e.g. structure-typed arguments - GetSystemTime() is an example which takes a structure containing 8 WORD-type elements for system time returned; in VBS, how to specify argument as required by CALL() function? and how to specify a "structure" in VBS?
Thanks for explanation with concrete code example.
Posted 26-Feb-12 23:43pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web02 | 2.8.150326.1 | Last Updated 27 Feb 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100