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:
http://office.microsoft.com/en-us/excel-help/using-the-call-and-register-functions-HP005209328.aspx
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
xlApp.Quit
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 <type_text> argument as required by CALL() function? and how to specify a "structure" in VBS?
Thanks for explanation with concrete code example.