Table of contents
TOC
折叠目录
展开目录

ObjectFrame.SourceDoc 属性 (访问)ObjectFrame.SourceDoc Property (Access)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

属性可以用于指定创建链接或嵌入在 Visual Basic 中使用操作属性中创建链接的对象或嵌入的对象的文件。读/写,字符串You can use the SourceDoc property to specify the file to create a link to or to embed when you create a linked object or embedded object by using the Action property in Visual Basic. Read/write String.

语法Syntax

表达式expression. SourceDoc

表达式_一个表示ObjectFrame对象的变量。_expression A variable that represents an ObjectFrame object.

注解Remarks

对于嵌入对象,请输入完整的路径和您要用作模板,将操作属性设置为acOLECreateEmbed的文件的文件名。For an embedded object, enter the full path and file name for the file you want to use as a template and set the Action property to acOLECreateEmbed.

对于链接对象,请输入要创建的链接,并将操作属性设置为acOLECreateLink的文件的完整路径和文件名称。For a linked object, enter the full path and file name of the file to create a link to and set the Action property to acOLECreateLink.

此属性将出现在属性表中,而只有在操作属性被设置在宏或通过使用 Visual Basic 后将生效。While this property appears in the property sheet, it takes effect only after the Action property is set in a macro or by using Visual Basic.

属性用于指定要创建的链接和控件的SourceItem属性指定的数据文件中的文件。如果您想要创建一个链接到整个对象,将SourceItem属性保留为空。You can use the SourceDoc property to specify the file to create a link to and the control's SourceItem property to specify the data within that file. If you want to create a link to the entire object, leave the SourceItem property blank.

创建链接的未绑定的对象时,控件的SourceItem属性设置被串联在一起,它的SourceItem属性设置。在窗体视图、 数据表视图和打印预览,控件的SourceItem属性设置为零长度字符串 (""),且其属性设置为链接文件,跟有感叹号 (!) 的完整路径或反斜杠 (\ ) 和SourceItem属性设置,如以下示例所示:When a linked unbound object is created, the control's SourceItem property setting is concatenated with its SourceItem property setting. In Form view, Datasheet view, and Print Preview, the control's SourceItem property setting is a zero-length string (" "), and its SourceDoc property setting is the full path to the linked file, followed by an exclamation point (!) or a backslash ( \ ) and the SourceItem property setting, as in the following example:

"C:\Work\Qtr1\Revenue.xls!R1C1:R30C15"

示例Example

下面的示例创建链接的 OLE 对象,使用未绑定的对象框,名为OLE1和控件大小,以在用户单击命令按钮时,显示对象的全部内容。The following example creates a linked OLE object using an unbound object frame named OLE1 and sizes the control to display the object's entire contents when the user clicks a command button.

Sub Command1_Click 
 OLE1.Class = "Excel.Sheet" ' Set class name. 
 ' Specify type of object. 
 OLE1.OLETypeAllowed = acOLELinked 
 ' Specify source file. 
 OLE1.SourceDoc = "C:\Excel\Oletext.xls" 
 ' Specify data to create link to. 
 OLE1.SourceItem = "R1C1:R5C5" 
 ' Create linked object. 
 OLE1.Action = acOLECreateLink 
 ' Adjust control size. 
 OLE1.SizeMode = acOLESizeZoom 
End Sub

另请参阅See also

概念Concepts

ObjectFrame 对象ObjectFrame Object

© 2018 Microsoft