GetCurrWrd: Get a Handle to a Running Word Instance

Description Usage Value Note Author(s) See Also Examples

View source: R/DescTools.r

Description

Look for a running Word instance and return its handle. NULL is returned if nothing's found.

Usage

1
2

Value

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

Note

Closing an instance does not update the value of the pointer. So it may contain an invalid address. Whether the pointer is still valid can be checked by IsValidHwnd.

Author(s)

Andri Signorell <andri@signorell.net>

See Also

GetNewWrd, IsValidHwnd

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: # Windows-specific example

x <- rnorm(100)

wrd <- GetCurrWrd()

if(IsValidHwnd(wrd)){ 
  Desc(x, wrd=wrd)
} else {
  print("GetCurrWrd: no running word instance found...")
}

## End(Not run)

Example output

Loading required namespace: RDCOMClient
Failed with error:there is no package calledRDCOMClient’’
Warning message:
In GetCOMAppHandle("Word.Application", option = "lastWord", existing = TRUE) :
  RDCOMClient is unfortunately not available for Linux systems (Windows-only).
[1] "GetCurrWrd: no running word instance found..."

DescTools documentation built on June 17, 2021, 5:12 p.m.