⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vbs553.htm

📁 VBScript 是一种脚本语言
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML><HEAD><TITLE>Source Property</TITLE> 
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="PRODUCT" CONTENT="Visual Basic Scripting Edition">
<META NAME="TECHNOLOGY" CONTENT="SCRIPTING">
<META NAME="CATEGORY" CONTENT="Language Reference">

<META NAME="Keywords" CONTENT="Source property,source of error"><META NAME="Description" CONTENT="Source Property"></HEAD><BODY BGCOLOR=FFFFFF LINK=#0033CC>
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END-->
<FONT FACE="Verdana, Arial, Helvetica" SIZE=2>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR VALIGN=TOP><TD WIDTH=360>
<FONT SIZE=1 COLOR=#660033>Microsoft&#174; Visual Basic&#174; Scripting Edition</FONT><BR>
<FONT SIZE=5 COLOR=#660033><B>Source Property</B></FONT>

</TD>
<TD ALIGN=RIGHT>
<FONT SIZE=2>&nbsp;<A HREF="vbstoc.htm">Language&nbsp;Reference</A>&nbsp;<BR>
<A HREF="vbs16.htm">Version&nbsp;1</A>&nbsp;<P></FONT>
</TD></TR>
</TABLE>
<FONT SIZE=2><P><A HREF="vbs555.htm">See Also</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="vbs554.htm">Applies to</A></FONT><HR NOSHADE SIZE=1>

<H5>Description</H5>
<BLOCKQUOTE>Returns or sets the name of the object or application that originally generated the error.</BLOCKQUOTE>

<H5>Syntax</H5>
<BLOCKQUOTE><i>object</i><b>.Source </b>[<b>= </b><i>stringexpression</i>]<P>
The <b>Source </b>property syntax has these parts:<P>

<TABLE WIDTH=87% BORDER=1 CELLPADDING=5 CELLSPACING=0>
<TR VALIGN=TOP BGCOLOR="#DDDDDD">
<TD><FONT SIZE=2><b>Part</b></FONT></TD>
<TD><FONT SIZE=2><b>Description</b></FONT></TD></TR>
<TR VALIGN=TOP>
<TD><FONT SIZE=2><i>object</i></FONT></TD>
<TD><FONT SIZE=2>Always the <b>Err</b> object.</FONT></TD></TR>
<TR VALIGN=TOP>
<TD><FONT SIZE=2><i>stringexpression</i></FONT></TD>
<TD><FONT SIZE=2>A <A HREF="vbs0.htm#defStringExpression">string expression</A> representing the application that generated the error.</FONT></TD></TR>
</TABLE></BLOCKQUOTE>

<H5>Remarks</H5>
<BLOCKQUOTE>The <b>Source</b> property specifies a string expression that is usually the <A HREF="vbs0.htm#defClass">class</A> name or programmatic ID of the object that caused the error. Use <b>Source</b> to provide your users with information when your code is unable to handle an error generated in an accessed object. For example, if you access Microsoft Excel and it generates a <i>Division by zero</i> error, Microsoft Excel sets <b>Err.Number</b> to its error code for that error and sets <b>Source</b> to Excel.Application. Note that if the error is generated in another object called by Microsoft Excel, Excel intercepts the error and sets <b>Err.Number</b> to its own code for <I>Division by zero</I>. However, it leaves the other <b>Err </b>object  (including <b>Source</b>) as set by the object that generated the error. <P>
<b>Source </b>always contains the name of the object that originally generated the error &#151; your code can try to handle the error according to the error documentation of the object you accessed. If your error handler fails, you can use the <b>Err</b> object information to describe the error to your user, using <b>Source </b>and the other <b>Err</b> to inform the user which object originally caused the error, its description of the error, and so forth.<P>When generating an error from code, <b>Source</b> is your application's programmatic ID. <!--For <A HREF="vbs0.htm#defClassModule">class modules</A>, <b>Source</b> should contain a name having the form <i>project</i><i><b>.</b></i><i>class</i>.--></BLOCKQUOTE>

<hr noshade size=1>
<p align=center><em><a href="../../common/colegal.htm">&copy; 1997 by Microsoft Corporation. All rights reserved.</a></em></p> 
</FONT></BODY></HTML>






















































































⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -