如何引用一个嵌入的PowerPoint或Excel文件在Access中的窗体? [英] How to reference an embedded PowerPoint or Excel file in a form in Access?

查看:241
本文介绍了如何引用一个嵌入的PowerPoint或Excel文件在Access中的窗体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,如果我是采取一个访问的形式,或者嵌入一个Excel US preadsheet进去还是一个PowerPoint甲板上,我将如何引用它的VBA code?

So if I was to take a an Access form, and embed either an Excel spreadsheet into it or a PowerPoint deck, how would I reference it in VBA code?

我知道我必须设置图书馆,命名OLE对象的框架,并使用适用的语法无论我想做的事,有什么我坚持的形式,但是我曾经用Excel做的唯一的事情, /或PowerPoint自动化是一个单独的窗口/应用程序从Access开放,而不是在访问形式。所以,我不知道如何着手。

I know I have to set the libraries, name the frame of the OLE object, and use applicable syntax to whatever I want to do, with whatever I stick in the form, however the only things I have ever done with Excel and/or PowerPoint is automate the opening of a seperate window/application from Access, not within the Access form. So I am not sure how to proceed.

如果我说了一个新Excel.Application,然后设置XLS =到(SS的文件中,而另一个Excel文件某处不是有些文件路径)?

If I said its a new Excel.Application, then set xls = to (the ss in the file, and not some file path of another Excel file somewhere)?

这是否有道理?

推荐答案

比方说,你增加了一个Excel工作簿中的对象的形式,将其命名为xLObject并添加一个引用到Excel对象库VBA

Let's say you added an Excel Workbook Object in your Form, named it xLObject and added a Reference to the Excel Object Library in VBA

下面是你如何访问该对象的表和更改范围

Here is how you Access a Sheet of this Object and change a Range

Dim sheet As Excel.Worksheet
Set sheet = xlObject.Object.Sheets(1)
sheet.Range("A1") = "Hello World"

同样的逻辑也适用于简报。

The same logic applies to Powerpoint.

这篇关于如何引用一个嵌入的PowerPoint或Excel文件在Access中的窗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆