M
MS Word macro
Hello, would you please assist me in solving this problem:
I have an Excel object (Excel.Sheet.1) in MS Word document. I'm trying to
write a Visual Basic macro for MS Word to change the data in cell A1 of this
table. How can I access the cell?
I'll try to describe the table I have to work with:
It's not a Word table. It's rather an Excel object present in my Word
document. When it's activated a real Excel table with 3 sheets appears.. and
if it's not activated, I just see a simple table which doesn't differ from a
regular Word table. I would say it's an Excel OLE placed in the Word document
I have to deal with.
I was adviced to open Excel by using a filename but I don't have a separate
Excel document which I open by using its name... I've applied the next to
find out the name of my object:
MsgBox ActiveDocument.Fields(1).OLEFormat.ProgID
The result is: Excel.Sheet.1
What I've surely succeeded to do is activating the object. And it seems
there are various ways of obtaining that, for example:
ActiveDocument.Fields(1).DoClick
ActiveDocument.Fields(1).OLEFormat.Edit
ActiveDocument.Fields(1).OLEFormat.Activate
....
and no way known to me to edit the object's contents...
I suppose I have to apply DDE to the object in order to open Excel, edit it
and then close Excel... I don't know how to do it yet... I hope that it's an
easy task some one has already an idea of..
Thank you!
I have an Excel object (Excel.Sheet.1) in MS Word document. I'm trying to
write a Visual Basic macro for MS Word to change the data in cell A1 of this
table. How can I access the cell?
I'll try to describe the table I have to work with:
It's not a Word table. It's rather an Excel object present in my Word
document. When it's activated a real Excel table with 3 sheets appears.. and
if it's not activated, I just see a simple table which doesn't differ from a
regular Word table. I would say it's an Excel OLE placed in the Word document
I have to deal with.
I was adviced to open Excel by using a filename but I don't have a separate
Excel document which I open by using its name... I've applied the next to
find out the name of my object:
MsgBox ActiveDocument.Fields(1).OLEFormat.ProgID
The result is: Excel.Sheet.1
What I've surely succeeded to do is activating the object. And it seems
there are various ways of obtaining that, for example:
ActiveDocument.Fields(1).DoClick
ActiveDocument.Fields(1).OLEFormat.Edit
ActiveDocument.Fields(1).OLEFormat.Activate
....
and no way known to me to edit the object's contents...
I suppose I have to apply DDE to the object in order to open Excel, edit it
and then close Excel... I don't know how to do it yet... I hope that it's an
easy task some one has already an idea of..
Thank you!