Click to Rate and Give Feedback
MSDN
MSDN Library
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Excel Primary Interop Assembly Reference 
_Application.Run Method 
Runs a macro or calls a function.

Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in microsoft.office.interop.excel.dll)

Visual Basic
Dim <span id="parameterToolTip" class="tip" tabindex="0">Macro</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg1</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg2</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg3</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg4</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg5</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg6</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg7</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg8</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg9</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg10</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg11</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg12</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg13</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg14</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg15</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg16</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg17</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg18</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg19</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg20</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg21</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg22</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg23</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg24</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg25</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg26</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg27</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg28</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg29</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Arg30</span> As Object
Dim returnValue As Object
Dim _Application1 As _Application
returnValue = _Application1.Run(<span id="parameterToolTip" class="tip" tabindex="0">Macro</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg1</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg2</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg3</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg4</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg5</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg6</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg7</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg8</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg9</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg10</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg11</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg12</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg13</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg14</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg15</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg16</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg17</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg18</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg19</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg20</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg21</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg22</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg23</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg24</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg25</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg26</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg27</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg28</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg29</span>, <span id="parameterToolTip" class="tip" tabindex="0">Arg30</span>)
Visual Basic
Function Run( _
	<InAttribute()> Optional ByVal Macro As Object, _
	<InAttribute()> Optional ByVal Arg1 As Object, _
	<InAttribute()> Optional ByVal Arg2 As Object, _
	<InAttribute()> Optional ByVal Arg3 As Object, _
	<InAttribute()> Optional ByVal Arg4 As Object, _
	<InAttribute()> Optional ByVal Arg5 As Object, _
	<InAttribute()> Optional ByVal Arg6 As Object, _
	<InAttribute()> Optional ByVal Arg7 As Object, _
	<InAttribute()> Optional ByVal Arg8 As Object, _
	<InAttribute()> Optional ByVal Arg9 As Object, _
	<InAttribute()> Optional ByVal Arg10 As Object, _
	<InAttribute()> Optional ByVal Arg11 As Object, _
	<InAttribute()> Optional ByVal Arg12 As Object, _
	<InAttribute()> Optional ByVal Arg13 As Object, _
	<InAttribute()> Optional ByVal Arg14 As Object, _
	<InAttribute()> Optional ByVal Arg15 As Object, _
	<InAttribute()> Optional ByVal Arg16 As Object, _
	<InAttribute()> Optional ByVal Arg17 As Object, _
	<InAttribute()> Optional ByVal Arg18 As Object, _
	<InAttribute()> Optional ByVal Arg19 As Object, _
	<InAttribute()> Optional ByVal Arg20 As Object, _
	<InAttribute()> Optional ByVal Arg21 As Object, _
	<InAttribute()> Optional ByVal Arg22 As Object, _
	<InAttribute()> Optional ByVal Arg23 As Object, _
	<InAttribute()> Optional ByVal Arg24 As Object, _
	<InAttribute()> Optional ByVal Arg25 As Object, _
	<InAttribute()> Optional ByVal Arg26 As Object, _
	<InAttribute()> Optional ByVal Arg27 As Object, _
	<InAttribute()> Optional ByVal Arg28 As Object, _
	<InAttribute()> Optional ByVal Arg29 As Object, _
	<InAttribute()> Optional ByVal Arg30 As Object _
) As Object
C#
object Run(
	[In, Optional] object Macro, 
	[In, Optional] object Arg1, 
	[In, Optional] object Arg2, 
	[In, Optional] object Arg3, 
	[In, Optional] object Arg4, 
	[In, Optional] object Arg5, 
	[In, Optional] object Arg6, 
	[In, Optional] object Arg7, 
	[In, Optional] object Arg8, 
	[In, Optional] object Arg9, 
	[In, Optional] object Arg10, 
	[In, Optional] object Arg11, 
	[In, Optional] object Arg12, 
	[In, Optional] object Arg13, 
	[In, Optional] object Arg14, 
	[In, Optional] object Arg15, 
	[In, Optional] object Arg16, 
	[In, Optional] object Arg17, 
	[In, Optional] object Arg18, 
	[In, Optional] object Arg19, 
	[In, Optional] object Arg20, 
	[In, Optional] object Arg21, 
	[In, Optional] object Arg22, 
	[In, Optional] object Arg23, 
	[In, Optional] object Arg24, 
	[In, Optional] object Arg25, 
	[In, Optional] object Arg26, 
	[In, Optional] object Arg27, 
	[In, Optional] object Arg28, 
	[In, Optional] object Arg29, 
	[In, Optional] object Arg30
);
C++
public: Object^ Run(
	Object^ Macro, 
	Object^ Arg1, 
	Object^ Arg2, 
	Object^ Arg3, 
	Object^ Arg4, 
	Object^ Arg5, 
	Object^ Arg6, 
	Object^ Arg7, 
	Object^ Arg8, 
	Object^ Arg9, 
	Object^ Arg10, 
	Object^ Arg11, 
	Object^ Arg12, 
	Object^ Arg13, 
	Object^ Arg14, 
	Object^ Arg15, 
	Object^ Arg16, 
	Object^ Arg17, 
	Object^ Arg18, 
	Object^ Arg19, 
	Object^ Arg20, 
	Object^ Arg21, 
	Object^ Arg22, 
	Object^ Arg23, 
	Object^ Arg24, 
	Object^ Arg25, 
	Object^ Arg26, 
	Object^ Arg27, 
	Object^ Arg28, 
	Object^ Arg29, 
	Object^ Arg30
);
J#
public System.Object Run(
	/*in*/System.Object Macro, 
	/*in*/System.Object Arg1, 
	/*in*/System.Object Arg2, 
	/*in*/System.Object Arg3, 
	/*in*/System.Object Arg4, 
	/*in*/System.Object Arg5, 
	/*in*/System.Object Arg6, 
	/*in*/System.Object Arg7, 
	/*in*/System.Object Arg8, 
	/*in*/System.Object Arg9, 
	/*in*/System.Object Arg10, 
	/*in*/System.Object Arg11, 
	/*in*/System.Object Arg12, 
	/*in*/System.Object Arg13, 
	/*in*/System.Object Arg14, 
	/*in*/System.Object Arg15, 
	/*in*/System.Object Arg16, 
	/*in*/System.Object Arg17, 
	/*in*/System.Object Arg18, 
	/*in*/System.Object Arg19, 
	/*in*/System.Object Arg20, 
	/*in*/System.Object Arg21, 
	/*in*/System.Object Arg22, 
	/*in*/System.Object Arg23, 
	/*in*/System.Object Arg24, 
	/*in*/System.Object Arg25, 
	/*in*/System.Object Arg26, 
	/*in*/System.Object Arg27, 
	/*in*/System.Object Arg28, 
	/*in*/System.Object Arg29, 
	/*in*/System.Object Arg30
);
JScript
function Run(
	 Macro : Object, 
	 Arg1 : Object, 
	 Arg2 : Object, 
	 Arg3 : Object, 
	 Arg4 : Object, 
	 Arg5 : Object, 
	 Arg6 : Object, 
	 Arg7 : Object, 
	 Arg8 : Object, 
	 Arg9 : Object, 
	 Arg10 : Object, 
	 Arg11 : Object, 
	 Arg12 : Object, 
	 Arg13 : Object, 
	 Arg14 : Object, 
	 Arg15 : Object, 
	 Arg16 : Object, 
	 Arg17 : Object, 
	 Arg18 : Object, 
	 Arg19 : Object, 
	 Arg20 : Object, 
	 Arg21 : Object, 
	 Arg22 : Object, 
	 Arg23 : Object, 
	 Arg24 : Object, 
	 Arg25 : Object, 
	 Arg26 : Object, 
	 Arg27 : Object, 
	 Arg28 : Object, 
	 Arg29 : Object, 
	 Arg30 : Object
) : Object;

Parameters

Macro

Optional Object. The macro to run. This can be either a string with the macro name, a Range object indicating where the function is, or a register ID for a registered DLL (XLL) function. If a string is used, the string will be evaluated in the context of the active sheet.

Arg1

Optional Object. The arguments that should be passed to the function.

Arg2

Optional Object. The arguments that should be passed to the function.

Arg3

Optional Object. The arguments that should be passed to the function.

Arg4

Optional Object. The arguments that should be passed to the function.

Arg5

Optional Object. The arguments that should be passed to the function.

Arg6

Optional Object. The arguments that should be passed to the function.

Arg7

Optional Object. The arguments that should be passed to the function.

Arg8

Optional Object. The arguments that should be passed to the function.

Arg9

Optional Object. The arguments that should be passed to the function.

Arg10

Optional Object. The arguments that should be passed to the function.

Arg11

Optional Object. The arguments that should be passed to the function.

Arg12

Optional Object. The arguments that should be passed to the function.

Arg13

Optional Object. The arguments that should be passed to the function.

Arg14

Optional Object. The arguments that should be passed to the function.

Arg15

Optional Object. The arguments that should be passed to the function.

Arg16

Optional Object. The arguments that should be passed to the function.

Arg17

Optional Object. The arguments that should be passed to the function.

Arg18

Optional Object. The arguments that should be passed to the function.

Arg19

Optional Object. The arguments that should be passed to the function.

Arg20

Optional Object. The arguments that should be passed to the function.

Arg21

Optional Object. The arguments that should be passed to the function.

Arg22

Optional Object. The arguments that should be passed to the function.

Arg23

Optional Object. The arguments that should be passed to the function.

Arg24

Optional Object. The arguments that should be passed to the function.

Arg25

Optional Object. The arguments that should be passed to the function.

Arg26

Optional Object. The arguments that should be passed to the function.

Arg27

Optional Object. The arguments that should be passed to the function.

Arg28

Optional Object. The arguments that should be passed to the function.

Arg29

Optional Object. The arguments that should be passed to the function.

Arg30

Optional Object. The arguments that should be passed to the function.

You cannot use named arguments with this method. Arguments must be passed by position.

The Run method returns whatever the called macro returns. Objects passed as arguments to the macro are converted to values (by applying the Value property to the object). This means that you cannot pass objects to macros by using the Run method.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker