vbaNOOB
Fri Apr 13 01:38:00 CDT 2007
WOW, It is great.
I have written 3 pages of code about copying image, but it did not work
out....
Another question, now the image is paste "together" in 1 page.
Is that a way that all images in the same page from the source doc are
pasted in 1 page of the tagart doc.
Sorry for my English
The example:
Source Doc-
page 1 have 3 images
page 2 no image
page 3 4 images
After running the VBA
Tagart Doc-
page 1 : all 3 images from source doc page 1
page 2 : all 4 images from source doc page 3
Many thanks
"Jean-Guy Marcil" wrote:
> vbaNOOB was telling us:
> vbaNOOB nous racontait que :
>
> > Hi
> >
> > I'm working on a task that copying all image a doc to another.
> > I got stuck when I meet textbox.
> >
> > All the image after the textbox actually go into the textbox !!!
> > There different types of image in doc, inshape, shape (texbox, line)
> > I found a sth that can exist from a textbox while the cusur is inside
> > the txtbox
> > but How do i if the cusur is inside the txtbox or not?
> >
> > Thinking I am using:
> >
> > for each shapes
> > select the shape
> > selection.cut
> > anotherdoc.activite
> > selection.paste
> > originaldoc.activite
> > next
>
> Use the Selection object as little as possible and do use objects as much as
> possible, like range, documents, shapes, etc.
>
> Try this:
>
> '_______________________________________
> Option Explicit
>
> '_______________________________________
> Public Sub BatchSaveAllAsDoc()
>
> Dim shpCopy As Shape
> Dim docSource As Document
> Dim docTarget As Document
> Dim rgeStart As Range
> Dim rgeTarget As Range
>
> Set rgeStart = Selection.Range
> Set docSource = ActiveDocument
> Set docTarget = Documents.Add
> Set rgeTarget = docTarget.Range
> rgeTarget.Collapse wdCollapseEnd
>
> For Each shpCopy In docSource.Shapes
> shpCopy.Select
> Selection.Copy
> With rgeTarget
> .Paste
> 'If you want all pasted shapes to be anchored to the first paragraph
> _
> then remove or comment out the following two lines
> .InsertParagraphAfter
> .Collapse wdCollapseEnd
> End With
> Next
>
> rgeStart.Select
>
> End Sub
> '_______________________________________
>
> --
>
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site:
http://www.word.mvps.org
>
>
>