

- #HOW TO SAVE AOI IMAGE PRO PLUS CODE#
- #HOW TO SAVE AOI IMAGE PRO PLUS DOWNLOAD#
- #HOW TO SAVE AOI IMAGE PRO PLUS WINDOWS#
If you omit one of the parameters (both aren’t necessary), pass vbNullString. If the function returns 0, it didn’t work - a window handle is never 0. Unfortunately, it doesn’t always work out that way. If you’re lucky, passing the object in the following form will work: object.Captionįor instance, you might try the following statement to return the handle of an Excel userform named ufrmEmployees: FindWindow(vbNullString, ufrmEmployees.Caption) The window name (lpWindowName) is usually the window’s caption see the window’s title bar. The class names for the three main Office applications are as follows: Dim lngWnd As Long apicFindWindow = FindWindow(strClassName, strWindowName) End Function Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Function apicFindWindow(strClassName As String, strWindowName As String) 'Get window handle. This function returns the handle for the Word document, December2010.docx. Specifically, you need the window’s class or name, as shown in the simple call below. This one can be a bit frustrating because it requires specialized information, and if you don’t get it just right, the function won’t work. You’ll need FindWindow, another API, for that. 5: FindWindowīringWindowToTop requires a handle value. When calling the function, pass the window handle value as a Long variable. Use the following declaration: Private Declare Function BringWindowToTop Lib "user32" _ (ByVal lngHWnd As Long) As Long If the function fails, it returns 0 if it’s successful, it will return a nonzero value. Simply pass the appropriate window handle. If the window is a child window, the function activates the associated top-level parent window. If the window is a top-level window, the function activates it. This API function brings the specified window to the top. Dim lngResponse As Long Dim strUserName As String * 32 lngResponse = GetComputerName(strUserName, 32) apicGetComputerName = Left(strUserName, InStr(strUserName, Chr$(0)) - 1) End Function 4: BringWindowToTop Declare it and call it, as follows: Private Declare Function GetComputerName Lib "kernel32" Alias _ "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function apicGetComputerName() As String 'Call to apiGetUserName returns current user. This next function, GetComputerName, is similar to GetUserName except it retrieves the system’s name. Dim lngResponse As Long Dim strUserName As String * 32 lngResponse = GetUserName(strUserName, 32) apicGetUserName = Left(strUserName, InStr(strUserName, Chr$(0)) - 1) End Function 3: GetComputerName Declare it and call it, passing the appropriate information, as follows: Private Declare Function GetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function apicGetUserName() As String 'Call to apiGetUserName returns current user. There are other ways to do this without calling an API, but this API is so simple, why would you bother writing your own code? GetUserName retrieves the name of the current system or the current user logged into the network. If you need to know who’s logged into an Access database, use GetUserName. Simply declare the function and then call it as shown from a VBA procedure: Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#HOW TO SAVE AOI IMAGE PRO PLUS CODE#
It places the running code into an inactive state for the number of milliseconds passed to the function. The Sleep function suspends execution for a specified period.
#HOW TO SAVE AOI IMAGE PRO PLUS DOWNLOAD#
Note: This article is also available for download as a PDF, along with a module containing the code examples discussed here. Once you know how the VBA procedures call the API functions and what to expect in return, you can modify the procedures as necessary and use them in your own projects. Execute the VBA procedures from the Immediate window, passing the necessary arguments, to see the results. However, a few could easily move into your code library as is. They are simple calls to the API, so you can see how the pieces work together. The VBA functions provided in this article aren’t real-world ready. (All of these tips are specific to 32-bit systems.) You can use them in most any Windows-based application. Although Office developers should find the APIs in this article useful, they’re not just for Office.

You’ll find thousands of useful functions.
#HOW TO SAVE AOI IMAGE PRO PLUS WINDOWS#
When that happens, turn to the Windows Application Programming Interface (API).


Sometimes, a VBA solution is convoluted or difficult to implement. But even though it’s versatile and robust, it doesn’t do everything. Susan Harkins lists 10 handy APIs and explains how you can put them to work. When a VBA solution falls short of your needs, there's probably a Windows API function that can handle the job. 10+ of my favorite Windows API functions to use in Office applications
