ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   OLE Object (https://www.excelbanter.com/excel-programming/374873-ole-object.html)

ohmmega

OLE Object
 
i've got a problem with an ole object...

following situtation:
- insert a worksheet as an ole object in open worksheet
- change some data in ole object

code (i write it by heart - maybe there are some errors):

Dim objOLE As OLEObject
Set objOLE = ActiveSheet.OLEObjects.Add( _
Filename:=ThisWorkbook.Path & "\Template.xls", Link:=False,
DisplayAsIcon:=False)

Dim myWorkbook As Workbook
set myWorkbook = objOLE.Object

With myWorkbook.Sheets(1)
.Range("$C$3") = "Whatsoever"
'do so for several ranges
End With

myWorkbook.Close

the code works without a problem, but shows no reaction. the oleobject
does not update. fine.
meanwhile i recognized the .VERB method and even if i don't like the
way it work - it seems to work - as long as i test my code step by
step. if i RUN the code i get an error message when i try to close the
workbook and excel crashes.

so please - somebody show me the right handling of the VERB method
(please complete code) or a possiblity to update the ole object (as
mentioned above).

that's all folks
rené



All times are GMT +1. The time now is 09:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com