views:

169

answers:

1

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 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.

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?

+3  A: 

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.

marg
super huge help! that is exactly what I needed! thanks!
Justin