atw: Re: Macro to modify Word and Excel files embedded in aWorddocument
- From: "Elizabeth Fullerton" <Elizabeth_Fullerton@xxxxxxxxxxx>
- To: <austechwriter@xxxxxxxxxxxxx>
- Date: Wed, 24 Aug 2005 11:53:52 +1000
Ok, back from holiday, and tackling this again.
Now, it is surprisingly easy to open each embedded document, do what I
need to do to it, save and close it... all except the Excel spreadsheet.
It's been a (really really really) long time since I wrote a macro which
manipulated applications other than the one the macro was written in.
Way back then it was relatively simple. Now I'm having some problems.
Basically, I've managed to get the Word macro to recognise that Excel is
open, but I can't get it to recognise the workbook that's open or
manipulate it.
The problem seems to be that you need to use Excel VBA commands, eg
ActiveWorkbook.Name, and these aren't recognised by Word VBA. And you
can't use the Word command ActiveDocument.Name on the Excel workbook
because it's a workbook not a document.
Does anyone have any idea how to get the Word macro to get to the Excel
spreadsheet - if I can get the Word macro to recognise
ActiveWorkbook.Name, then I can figure out the other stuff.
I've been mucking around with this for a while now, with no luck, so I'm
hoping someone will be able to point me in the right direction, or I may
have to actually learn how to programme in VBA...
-----Original Message-----
From: austechwriter-bounce@xxxxxxxxxxxxx
[mailto:austechwriter-bounce@xxxxxxxxxxxxx] On Behalf Of Elizabeth
Fullerton
Sent: Monday, 8 August 2005 9:32 AM
To: austechwriter@xxxxxxxxxxxxx
Subject: atw: Re: Macro to modify Word and Excel files embedded in
aWorddocument
The code below opens the embedded documents I want - the third embedded
file in the open document, and the first embedded file within that.
The first embedded document opens, then the macro works on that doc and
opens the file embedded inside it.
So now I have to stick in the instructions for the second doc (change a
doc property, update fields, save and close it), then instructions for
the first doc (same as for first doc).
And start it off with a dialog, so users can put in the value for the
doc property.
This was surprisingly easy to find an answer to, probably due to some
lucky searching and dabbling. Or my superior skill...
Sub OpenEmbeddedDocs()
Dim DocIndex1
Dim DocIndex2
DocIndex1 = 3
DocIndex2 = 1
ActiveDocument.InlineShapes(DocIndex1 ).Activate
ActiveDocument.InlineShapes(DocIndex2 ).Activate
End Sub
Regards
Elizabeth Fullerton
Business Solutions Architect
Infosys Australia
Tel: +61 3 9911 3529
Fax: +61 3 9911 3407
www.infosys.com
Powered by Intellect
Driven by values
-----Original Message-----
From: austechwriter-bounce@xxxxxxxxxxxxx
[mailto:austechwriter-bounce@xxxxxxxxxxxxx] On Behalf Of Steve Hudson
Sent: Friday, 5 August 2005 9:25 PM
To: austechwriter@xxxxxxxxxxxxx
Subject: atw: Re: Macro to modify Word and Excel files embedded in a
Worddocument
If you DoVerb on the OLE objects you can open them into their own app
window, which you can then trap and use.
-----Original Message-----
From: austechwriter-bounce@xxxxxxxxxxxxx
[mailto:austechwriter-bounce@xxxxxxxxxxxxx] On Behalf Of Elizabeth
Fullerton
Sent: Friday, 5 August 2005 4:08 PM
To: austechwriter@xxxxxxxxxxxxx
Subject: atw: Macro to modify Word and Excel files embedded in a Word
document
Hi all
I've been asked to create a macro that will modify Word and Excel files
embedded in a Word document.
Please don't ask why these documents are embedded, and also don't ask
about
how many iterations there are of documents embedded in embedded
documents,
because the answer is very scary and it's something I can't change.
Anyway, I was wondering if anybody knows:
- If it is possible for macros to modify documents embedded in a
document?
It's actually a template, so the embedded doc names would be known.
(Once
again, don't ask...) I'm thinking something along the lines of opening
the
embedded document, doing some stuff to it, and closing it again - with
screen updating turned off so it doesn't look like it's freaking out.
- If this is possible, does anybody know of a source of some basic code
that
I can hack apart and use for my own purposes? I've had a look on MVPS,
but
nothing comes up with a search, so either it can't be done (or hasn't
been
tried), or my search criteria sucks. I'm going to continue googling, but
if
someone knows of something off-hand, that would be easier for me!
Thanks
Elizabeth Fullerton
Business Solutions Architect
Infosys Australia
Tel: +61 3 9911 3529
Fax: +61 3 9911 3407
www.infosys.com <http://www.infosys.com/> Powered by Intellect Driven by
values
**************** CAUTION - Disclaimer ***************** This e-mail
contains
PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of
the
addressee(s). If you are not the intended recipient, please notify the
sender by e-mail and delete the original message. Further, you are not
to
copy, disclose, or distribute this e-mail or its contents to any other
person and any such actions are unlawful. This e-mail may contain
viruses.
Infosys has taken every reasonable precaution to minimize this risk, but
is
not liable for any damage you may sustain as a result of any virus in
this
e-mail. You should carry out your own virus checks before opening the
e-mail
or attachment. Infosys reserves the right to monitor and review the
content
of all messages sent to or from this e-mail address. Messages sent to or
from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
**************************************************
To post a message to austechwriter, send the message to
austechwriter@xxxxxxxxxxxxxx
To subscribe to austechwriter, send a message to
austechwriter-request@xxxxxxxxxxxxx with "subscribe" in the Subject
field.
To unsubscribe, send a message to austechwriter-request@xxxxxxxxxxxxx
with
"unsubscribe" in the Subject field.
To search the austechwriter archives, go to
www.freelists.org/archives/austechwriter
To contact the list administrator, send a message to
austechwriter-admins@xxxxxxxxxxxxx
**************************************************
**************************************************
To post a message to austechwriter, send the message to
austechwriter@xxxxxxxxxxxxxx
To subscribe to austechwriter, send a message to
austechwriter-request@xxxxxxxxxxxxx with "subscribe" in the Subject
field.
To unsubscribe, send a message to austechwriter-request@xxxxxxxxxxxxx
with "unsubscribe" in the Subject field.
To search the austechwriter archives, go to
www.freelists.org/archives/austechwriter
To contact the list administrator, send a message to
austechwriter-admins@xxxxxxxxxxxxx
**************************************************
**************************************************
To post a message to austechwriter, send the message to
austechwriter@xxxxxxxxxxxxxx
To subscribe to austechwriter, send a message to
austechwriter-request@xxxxxxxxxxxxx with "subscribe" in the Subject
field.
To unsubscribe, send a message to austechwriter-request@xxxxxxxxxxxxx
with "unsubscribe" in the Subject field.
To search the austechwriter archives, go to
www.freelists.org/archives/austechwriter
To contact the list administrator, send a message to
austechwriter-admins@xxxxxxxxxxxxx
**************************************************
**************************************************
To post a message to austechwriter, send the message to
austechwriter@xxxxxxxxxxxxxx
To subscribe to austechwriter, send a message to
austechwriter-request@xxxxxxxxxxxxx with "subscribe" in the Subject field.
To unsubscribe, send a message to austechwriter-request@xxxxxxxxxxxxx with
"unsubscribe" in the Subject field.
To search the austechwriter archives, go to
www.freelists.org/archives/austechwriter
To contact the list administrator, send a message to
austechwriter-admins@xxxxxxxxxxxxx
**************************************************
- Follow-Ups:
- atw: Re: Macro to modify Word and Excel files embedded in aWorddocument
- From: Steve Hudson
Other related posts:
- » atw: Re: Macro to modify Word and Excel files embedded in aWorddocument
- » atw: Re: Macro to modify Word and Excel files embedded in aWorddocument
- » atw: Re: Macro to modify Word and Excel files embedded in aWorddocument
- atw: Re: Macro to modify Word and Excel files embedded in aWorddocument
- From: Steve Hudson