DescTools (version 0.99.54)

GetCurrWrd: Get a Handle to a Running Word/Excel Instance

Description

Look for a running Word, resp. Excel instance and return its handle. If no running instance is found a new instance will be created (which will be communicated with a warning).

Usage

GetCurrWrd()
GetCurrXL()

Arguments

Value

a handle (pointer) to the running Word, resp. Excel instance.

Author

Andri Signorell <andri@signorell.net>

See Also

GetNewWrd, IsValidHwnd

Examples

Run this code
if (FALSE) # Windows-specific example

# Start a new instance
GetNewWrd()

# grab the handle to this instance
wrd <- GetCurrWrd()

# this should be valid
IsValidHwnd(wrd)

# close the instance
wrd$quit()

# now it should be gone and the pointer invalid
if(IsValidHwnd(wrd)){ 
  print("Ouups! Still there?")
} else {  
  print("GetCurrWrd: no running word instance found...")
}

Run the code above in your browser using DataCamp Workspace