AccessBlog.net

News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Alex
Name:Alex Dybenko

Location:Moscow, Russia

Monday, September 05, 2005

How to modify embedded MS Office document


Say you have a Bound Object Frame on your form, bound to OLE Object field type. User has inserted a MS Office document there, for example Excel Sheet, and you want to modify it contents. The trick is that you have to activate field first, using Action property, and then modify its content. Here a code from sample procedure:

Private Sub cmdModifyExcel_Click()

Dim oSheet As Object

Me.oleExcelObj.Action = acOLEActivate
Set oSheet = Me.oleExcelObj.Object.Sheets(1)
oSheet.Cells(1, 1).Value = "Hi from VBA!"
Me.oleExcelObj.Action = acOLEClose

Set oSheet = Nothing

End Sub

1 Comments:

Anonymous Epa Internships said...

Thanks for sharing and keep sharing these kind of informative posts.

9:44 AM  

Post a Comment

<< Home