Microsoft KB Archive/110754

= Macro to Determine If Excel Is Open for In-Place Editing =

Article ID: 110754

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Excel 97 Standard Edition

-



This article was previously published under Q110754



SUMMARY
In Microsoft Excel, there is no Visual Basic function to determine whether Microsoft Excel is open for in-place editing. To return this information in a Visual Basic procedure, you can run a Microsoft Excel 4.0 macro that uses the GET.WORKSPACE macro function.

In Microsoft Excel 97, you can run the following line of code to determine if Microsoft Excel is open for in-place editing: MsgBox ActiveWorkbook.IsInplace



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. When you embed a Microsoft Excel worksheet or chart in a program that supports in-place activation, when you double-click the embedded object, you remain in the client application but the menus and toolbars change to those of Microsoft Excel. It may be useful in a Visual Basic procedure to determine whether Microsoft Excel is open for in-place editing. For example, you may create an add-in that needs to perform different actions if Microsoft Excel is open for in-place editing.

The GET.WORKSPACE macro function returns information about the workspace. You can use this function with the following syntax to determine whether Microsoft Excel is open for in-place editing: =GET.WORKSPACE(71) To return this information in a Visual Basic procedure, you can use the RUN method to run a Microsoft Excel version 4.0 macro containing the GET.WORKSPACE(71) function. The following procedure, demonstrates how to use this method.  In a new Microsoft Excel 4.0 macro sheet, enter the following:

A1: Inplace_Edit

A2: =ALERT(GET.WORKSPACE(71))

A3: =RETURN

 Select cell A1. On the Insert menu, point to Name, and then click Define. In the Names In Workbook box, type Inplace_Edit. In the Refers To box, type =Macro1!$A$1. Under Macro, select the Command option, and then click OK.  In a new Visual Basic module, type the following: Sub Test MsgBox Application.ExecuteExcel4Macro("GET.WORKSPACE(71)") End Sub 

When you run the Visual Basic procedure "Test," a message box appears with the value "True" if Microsoft Excel is open for in-place editing, or "False" if Microsoft Excel is open for normal editing.

