Commands & Syntax > Commands > Excel >

www.perfectkeyboard.com

 

Open/Create workbook - < excel_wb_open >() ... [Pro]

 

Excel: Open/Create workbook
<excel_wb_open>("Workbook","Worksheet",Show,Workbook identifier)
Available in: Professional edition

This command opens a Microsoft ® Excel ® application with defined workbook (file) open (or opens Excel ® with a newly created empty workbook). "Close workbook" command must be used to properly close Excel workbook.
Note: Microsoft ® and Excel ® are Microsoft Corporation registered trademarks.

 

#

Parameter name

Parameter description

1

Workbook

The workbook (file) to open. If empty then a new workbook is created.

2

Worksheet

The worksheet to activate. If empty then last active worsheet is activated.

3

Show

Excel window is visible:
0 - No
1 - Yes

4

Workbook identifier

Variable that receives identifier of the workbook. This identntifer can be used for "close workbook" and other workbook related commands.

 

Example (Macro Steps):

 

1

<#> <#>This macro shows how to open and close an Excel workbook

2

Macro execution: ONLY COMMANDS

3

Excel: Open/Create workbook "" (Worksheet = "", Show = "Yes", Workbook identifier = "wbi")

4

Message SHOW "Information" : "A new Excel workbook is open and will be closed now." (other parameters: x = -100, y = -100, Window title = Excel Open/Close, Buttons = OK, Timeout (seconds) = 0, Always on top = No).

5

Excel: Close workbook "%wbi%" (SAVE = "No")

Example (Plain Text):

 

<#>This macro shows how to open and close an Excel workbook

<cmds>

<excel_wb_open>("","",1,wbi)

<msg>(-100,-100,"A new Excel workbook is open and will be closed now.","Excel Open/Close",1,0,0,0)

<excel_wb_close>(%wbi%,0)