This line of code will go in the body of your macro, usuaally near the top. In the parameter, substiutute the number of documents that must be available for your macro to work.
vNumOpen:=CheckOpenDocs(2)
Place this routine towards the bottom of the macro, along with any other PROCEDURES or FUNCTIONS.
//****************************************************************
// Copyright (c) 1999 J Jeppson All Rights Reserved.
// http://www.wpmacros.com
// Function: CheckOpenDocs(vNumNeeded)
// Purpose: Check if correct number of open docs are available
// Action: If specified number is not available,quit macro.
// If specified number is available, return number open back
// Input: Number of documents needed by macro
// Output: The number of available documents, if >= Input.
//*****************************************************************
FUNCTION CheckOpenDocs(vNumNeeded)
vOpen:=9-?NumberOpenDocuments
If(vOpen >= vNumNeeded)
Return(vOpen)
Else
vNeedToClose:=vNumNeeded - vOpen
MessageBox(vstatus;"Can't Continue"; "There are not enough open
documents available. Please close "+vNeedToClose+" document(s) and
restart the macro.")
Quit
Endif
EndFunc
Terms of Use:
You may include the code displayed here in your own macros with the following conditions:
| The code must be included in its entirety, including copyright and header information. | |
| You may use the code in macros used within your own organization, as part of your job, for your employer, or for your own personal use. | |
| You may modify the code to meet your own needs. | |
| If you modify any code in the routine, you must comment out the original line of code, and leave that original line intact, then type a new line of code with the change that you made. You must then add a comment noting your change. | |
| You may not use the code in macros you create for hire, other than at your regular work for an employer, where the macrowill be used in-house. For example, you may not use this routine in macros you create, modify, or convert for hire as a consultant for a company or individual that you are not a regular employee for. | |
| You may not sell or publish macros that use this routine in any form. | |
| You accept full responsibility for macros that you include this routine in. | |
| J Jeppson will not be obligated to make the code work for you, or for your particular need or usage. | |
| Under no circumstances will J Jeppson be held liable for any damages or liabilities incurred while using this code. |