开发者

How to reference an embedded PowerPoint or Excel file in a form in Access?

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?

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 wha开发者_运维问答tever 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.

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)?

Does that make sense?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜