A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Formatting Long Documents
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Image alignment disturbs in Pastespecial



 
 
Thread Tools Display Modes
  #1  
Old May 28th, 2004, 08:55 AM
anand
external usenet poster
 
Posts: n/a
Default Image alignment disturbs in Pastespecial

Hello Group
I am converting all EMFs of a word document into GIF using Paste special
Selection.PasteSpecial Link:=False, DataType:=13, Placement:= _
wdFloatOverText, DisplayAsIcon:=False
The probelm is that after allignment it disturbs the aligmant of images and
by default it takes left.
Has any one any idea how i can persist the alignment.

Thanks

Anand


  #2  
Old May 28th, 2004, 02:18 PM
Jean-Guy Marcil
external usenet poster
 
Posts: n/a
Default Image alignment disturbs in Pastespecial

Bonjour,

Dans son message, anand écrivait :
In this message, anand wrote:

|| Hello Group
|| I am converting all EMFs of a word document into GIF using Paste special
|| Selection.PasteSpecial Link:=False, DataType:=13, Placement:= _
|| wdFloatOverText, DisplayAsIcon:=False
|| The probelm is that after allignment it disturbs the aligmant of images
and
|| by default it takes left.
|| Has any one any idea how i can persist the alignment.
||

I think we need more details here...
I.ll go out on a limb here...
You mention an alignment that is disturbed in some way. Are you talking
about the new picture's alignment? If so,
Placement:= wdFloatOverText
in your code will not necessarily mean that the new picture will be wrapped
in the same way as the original one was.
You have to record the original picture parameters before cutting it.

Play around with the following code to get an idea of how it works. Just
select a picture and run the code.

'_______________________________________
Dim MyPix As Shape
Dim MyRange As Range
Dim PixWrap As Long
Dim PixWrapSide As Long
Dim PixTop As Long
Dim PixLeft As Long

With Selection.ShapeRange
With .WrapFormat
PixWrap = .Type
PixWrapSide = .Side
End With
PixTop = .Top
PixLeft = .Left
End With

Selection.Cut

Set MyRange = Selection.Range

MyRange.PasteSpecial Link:=False, DataType:=13, Placement:= _
wdFloatOverText, DisplayAsIcon:=False

Set MyPix = MyRange.ShapeRange(1)

With MyPix
With .WrapFormat
.Type = PixWrap
.Side = PixWrapSide
End With
.Left = PixLeft
.Top = PixTop
End With

MyPix.Select

Set MyPix = Nothing
Set MyRange = Nothing
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org



  #3  
Old May 28th, 2004, 04:23 PM
anand
external usenet poster
 
Posts: n/a
Default Image alignment disturbs in Pastespecial

Jean

If I select a picture, it works perfectly, but If I run on whole
document(having 45 pages with 1 or 2 iamge on each page), its postion get
disturbed. Here is the code, let me know what wrong I am doing?

*-------------------------
Dim MyPix As Shape
Dim MyRange As Range
Dim PixWrap As Long
Dim PixWrapSide As Long
Dim PixTop As Long
Dim PixLeft As Long
Dim s

For Each s In ActiveDocument.Shapes
If s.Type = msoPicture Then
s.Select
With Selection.ShapeRange
With .WrapFormat
PixWrap = .Type
PixWrapSide = .Side
End With
PixTop = .Top
PixLeft = .Left
End With

Selection.Cut

Set MyRange = Selection.Range

MyRange.PasteSpecial Link:=False, DataType:=13, Placement:= _
wdFloatOverText, DisplayAsIcon:=False

Set MyPix = MyRange.ShapeRange(1)

With MyPix
With .WrapFormat
.Type = PixWrap
.Side = PixWrapSide
End With
.Left = PixLeft
.Top = PixTop
End With

MyPix.Select

Set MyPix = Nothing
Set MyRange = Nothing


End If
Next s
End Sub
*-------------------------


"Jean-Guy Marcil" wrote in message
...
Bonjour,

Dans son message, anand écrivait :
In this message, anand wrote:

|| Hello Group
|| I am converting all EMFs of a word document into GIF using Paste

special
|| Selection.PasteSpecial Link:=False, DataType:=13, Placement:= _
|| wdFloatOverText, DisplayAsIcon:=False
|| The probelm is that after allignment it disturbs the aligmant of

images
and
|| by default it takes left.
|| Has any one any idea how i can persist the alignment.
||

I think we need more details here...
I.ll go out on a limb here...
You mention an alignment that is disturbed in some way. Are you talking
about the new picture's alignment? If so,
Placement:= wdFloatOverText
in your code will not necessarily mean that the new picture will be

wrapped
in the same way as the original one was.
You have to record the original picture parameters before cutting it.

Play around with the following code to get an idea of how it works. Just
select a picture and run the code.

'_______________________________________
Dim MyPix As Shape
Dim MyRange As Range
Dim PixWrap As Long
Dim PixWrapSide As Long
Dim PixTop As Long
Dim PixLeft As Long

With Selection.ShapeRange
With .WrapFormat
PixWrap = .Type
PixWrapSide = .Side
End With
PixTop = .Top
PixLeft = .Left
End With

Selection.Cut

Set MyRange = Selection.Range

MyRange.PasteSpecial Link:=False, DataType:=13, Placement:= _
wdFloatOverText, DisplayAsIcon:=False

Set MyPix = MyRange.ShapeRange(1)

With MyPix
With .WrapFormat
.Type = PixWrap
.Side = PixWrapSide
End With
.Left = PixLeft
.Top = PixTop
End With

MyPix.Select

Set MyPix = Nothing
Set MyRange = Nothing
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org





  #4  
Old May 28th, 2004, 06:21 PM
Jean-Guy Marcil
external usenet poster
 
Posts: n/a
Default Image alignment disturbs in Pastespecial

Bonjour,

Dans son message, anand écrivait :
In this message, anand wrote:

|| Jean
||
|| If I select a picture, it works perfectly, but If I run on whole
|| document(having 45 pages with 1 or 2 iamge on each page), its postion get
|| disturbed. Here is the code, let me know what wrong I am doing?
||

The following worked for me on a document with 2 pages and 4 pictures:

'_______________________________________
Sub Test()

Dim MyPix As Shape
Dim PastedPix As Shape
Dim MyRange As Range
Dim PixWrap As Long
Dim PixWrapSide As Long
Dim PixTop As Long
Dim PixLeft As Long

Set MyRange = Selection.Range

For Each MyPix In ActiveDocument.Range.ShapeRange

If MyPix.Type = msoPicture Then

With MyPix
With .WrapFormat
PixWrap = .Type
PixWrapSide = .Side
End With
PixTop = .Top
PixLeft = .Left
.Select
End With

Selection.Cut

Selection.PasteSpecial Link:=False, DataType:=13, Placement:= _
wdFloatOverText, DisplayAsIcon:=False
Set PastedPix = Selection.ShapeRange(1)

With PastedPix
With .WrapFormat
.Type = PixWrap
.Side = PixWrapSide
End With
.Left = PixLeft
.Top = PixTop
End With

Set PastedPix = Nothing

End If
Next MyPix

MyRange.Select

Set MyRange = Nothing

End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org



  #5  
Old May 29th, 2004, 07:01 AM
anand
external usenet poster
 
Posts: n/a
Default Image alignment disturbs in Pastespecial

Hello Bonjour, Thanks alot , it has solved problem to certain extent.
Actuallu when we cut that image with
selection.cut
the Texts that follow image moves up imidiately and affects the alignment.I
am trying for it. what do you say?
Anand
"Jean-Guy Marcil" wrote in message
...
Bonjour,

Dans son message, anand écrivait :
In this message, anand wrote:

|| Jean
||
|| If I select a picture, it works perfectly, but If I run on whole
|| document(having 45 pages with 1 or 2 iamge on each page), its postion

get
|| disturbed. Here is the code, let me know what wrong I am doing?
||

The following worked for me on a document with 2 pages and 4 pictures:

'_______________________________________
Sub Test()

Dim MyPix As Shape
Dim PastedPix As Shape
Dim MyRange As Range
Dim PixWrap As Long
Dim PixWrapSide As Long
Dim PixTop As Long
Dim PixLeft As Long

Set MyRange = Selection.Range

For Each MyPix In ActiveDocument.Range.ShapeRange

If MyPix.Type = msoPicture Then

With MyPix
With .WrapFormat
PixWrap = .Type
PixWrapSide = .Side
End With
PixTop = .Top
PixLeft = .Left
.Select
End With

Selection.Cut

Selection.PasteSpecial Link:=False, DataType:=13, Placement:= _
wdFloatOverText, DisplayAsIcon:=False
Set PastedPix = Selection.ShapeRange(1)

With PastedPix
With .WrapFormat
.Type = PixWrap
.Side = PixWrapSide
End With
.Left = PixLeft
.Top = PixTop
End With

Set PastedPix = Nothing

End If
Next MyPix

MyRange.Select

Set MyRange = Nothing

End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org





  #6  
Old May 30th, 2004, 07:31 PM
Jean-Guy Marcil
external usenet poster
 
Posts: n/a
Default Image alignment disturbs in Pastespecial

Bonjour,

Dans son message, anand écrivait :
In this message, anand wrote:

|| Hello Bonjour, Thanks alot , it has solved problem to certain extent.
|| Actuallu when we cut that image with
|| selection.cut
|| the Texts that follow image moves up imidiately and affects the
alignment.I
|| am trying for it. what do you say?

I say "No problem"!
Because when you paste the image back to the exact same location with the
same wrapping, the text goes back to where it was. At least, on my machine,
that is what happens. So I do hot understand you having a problem with the
text moving.... Or are you stopping the code before the paste is done?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org



  #7  
Old June 2nd, 2004, 07:23 AM
anand
external usenet poster
 
Posts: n/a
Default Image alignment disturbs in Pastespecial

Hello there, yah you got my problem wright way.I am still having problem.
how can I stop code b4 paste is done as when it cuts the image texts
automatically move up.Looking for more work arounds.

Rgds
Anand


----- Original Message -----
From: "Jean-Guy Marcil"
Newsgroups:
microsoft.public.vb.general.discussion,microsoft.p ublic.word.conversions,mic
rosoft.public.word.docmanagement,microsoft.public. word.formatting.longdocs,m
icrosoft.public.word.vba.general
Sent: Monday, May 31, 2004 12:01 AM
Subject: Image alignment disturbs in Pastespecial


Bonjour,

Dans son message, anand écrivait :
In this message, anand wrote:

|| Hello Bonjour, Thanks alot , it has solved problem to certain extent.
|| Actuallu when we cut that image with
|| selection.cut
|| the Texts that follow image moves up imidiately and affects the
alignment.I
|| am trying for it. what do you say?

I say "No problem"!
Because when you paste the image back to the exact same location with the
same wrapping, the text goes back to where it was. At least, on my

machine,
that is what happens. So I do hot understand you having a problem with the
text moving.... Or are you stopping the code before the paste is done?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org





  #8  
Old June 2nd, 2004, 01:55 PM
Jean-Guy Marcil
external usenet poster
 
Posts: n/a
Default Image alignment disturbs in Pastespecial

Bonjour,

Dans son message, anand écrivait :
In this message, anand wrote:

|| Hello there, yah you got my problem wright way.I am still having problem.
|| how can I stop code b4 paste is done as when it cuts the image texts
|| automatically move up.Looking for more work arounds.
||

I still do not get it.
Why would you want to stop the code before the past action?

And, whenever you cut something, the text will always move to fill the space
previously occupied by the object that was cut. Unless you paste something
back in its place...

So, I do not understand your problem. You wanted to take a picture, cut it
out and paste it back in a different format with PasteSpecial. The code I
posted does just that. Why are you still having problems? If you have
changed your requirement or goal along the line, you have not explicitly
written about it, or I totally missed out on something.

Sorry. If you still need help, you are going to have to be more explicit.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org



  #9  
Old June 5th, 2004, 08:44 AM
anand
external usenet poster
 
Posts: n/a
Default Image alignment disturbs in Pastespecial

Bonjour ,
My problem was that after Pasting the image back to its place the texts
were not moving to right place so was creating problem.Anyways now cheers we
got the perfect macro does not disturb any thing what so ever.Thanks for
your throughout support,

Regards
Anand

"Jean-Guy Marcil" wrote in message
...
Bonjour,

Dans son message, anand écrivait :
In this message, anand wrote:

|| Hello there, yah you got my problem wright way.I am still having

problem.
|| how can I stop code b4 paste is done as when it cuts the image texts
|| automatically move up.Looking for more work arounds.
||

I still do not get it.
Why would you want to stop the code before the past action?

And, whenever you cut something, the text will always move to fill the

space
previously occupied by the object that was cut. Unless you paste something
back in its place...

So, I do not understand your problem. You wanted to take a picture, cut it
out and paste it back in a different format with PasteSpecial. The code I
posted does just that. Why are you still having problems? If you have
changed your requirement or goal along the line, you have not explicitly
written about it, or I totally missed out on something.

Sorry. If you still need help, you are going to have to be more explicit.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org





  #10  
Old June 6th, 2004, 04:11 AM
Jean-Guy Marcil
external usenet poster
 
Posts: n/a
Default Image alignment disturbs in Pastespecial

Bonjour,

Dans son message, anand écrivait :
In this message, anand wrote:

|| Bonjour ,
|| My problem was that after Pasting the image back to its place the texts
|| were not moving to right place so was creating problem.Anyways now cheers
we
|| got the perfect macro does not disturb any thing what so ever.Thanks for
|| your throughout support,
||
|| Regards
|| Anand

Glad you sorted things out!

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:34 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.