Problem with embedded Sheet in VB program
Bingo! It was a workbook. I guess I jumped to conclusions
because of the class name Excel.Sheet.8.
Thanks for the help.
With kind Regards,
Frank
-----Original Message-----
Why not test the type of OLE_keyfig.object
msgbox typename(OLE_keyfig.object)
and see what you have.
From what you describe, it doesn't have a Range
property, so it probably
isn't a sheet. It might be a workbook which doesn't
have this property.
--
Regards,
Tom Ogilvy
"Frank" wrote in message
...
I am designing an application which update a
spreadsheet
that I have embedded in a form in an OlE container
control.
Now, I was hoping to update the spreadsheet through the
application. However, it does not seem that it is
really
available through the OLE container.
OLE_keyfig is my container at design time I have
embedded
a spreadsheet with the desired format.
Designtime settings for properties:
.Class = "Excel.Sheet.8"
.Autoactivate = "3 - Automatic"
.OLETypeAllowed = "1 - Embedded"
.UpdateOptions = "0 - Automatic"
.SourceDoc points to my original workbook, but once it
is
embedded that should not matter (and the file is
avaiable)
rs_firma is an active recordset
This is the statement that does not work:
OLE_keyfig.object.Range("B1").Value = rs_firma.Fields
("kundenr").Value
When I run it the following happens:
a. It seems that the spreadsheet is loaded, as I get
asked whether macros should be active or not (standard
when opening)
b. I get an error: Object doesn't support this property
or method (Error 438)
If I go to the debugger and add a watch for
OLE_keyfig.object.Name it is out of context.
Normally, when you have access to a sheet object you
can
then get to a Range object, so I do not see why it
would
not be valid.
Can anyone give me a hint to how I can access the
Sheet.
If it cannot be done, I will instead make my changes to
the external sheet and then have that linked instead of
embedded. But I would prefer to go ahead with my
original
idea, if it can be done.
With kind regards,
Frank
.
|