View Full Version : WORD 2002-2007
hajoschi
01-20-2012, 04:11 AM
Hello,
after I've inserted a graphic, I want to format it:
Layout - behind the text - picture position - options: activate all.
Word offers no way to create a macro.
Can someone give me the code?
Thank you
hajoschi
rruckus
01-23-2012, 02:00 PM
Try converting it to a shape first and then you can change the position and options.
dim oShape as Shape
set Shape = Selection.InlineShapes(1).ConvertToShape
hajoschi
01-24-2012, 10:12 AM
Hi rruckus,
thanks for the reply.
I've found a quick solution (WORD 2002):
Sub grafikformat()
SendKeys "%tg{LEFT}%t{Enter}"
end sub
greetings
hajoschi
rruckus
01-24-2012, 10:31 AM
SendKeys won't always work for you and it's not very robust. I'd advise against it and use ConvertToShape instead. But it's up to you!
hajoschi
01-25-2012, 02:35 AM
Hi rruckus,
after inserting an image into Word, the entry 'behind the text' is inactive,
the entry 'move object with text' active.
After application of the following VBA procedure
the entry 'behind the text' is active,
the entry 'Move object with text' is not active.
Because of the lack of VBA knowledge I do not know how I can again the entry 'move object with text' put on 'active'.
Where should I insert your suggestion?
greetings
hajoschi
Sub ChangeLayout()
'
' ChangeLayout Makro
' Makro erstellt am 04.04.2006 von
'
Dim objSelection As Object
Dim strImageName As String
Dim objImage As Shape
On Error Resume Next
Set objSelection = Selection.InlineShapes(1)
If objSelection Is Nothing Then
strImageName = Selection.ShapeRange.Name
Set objImage = ActiveDocument.Shapes(strImageName)
If objImage Is Nothing Then
MsgBox Prompt:="Sie müssen eine Grafik markieren!", _
Buttons:=vbCritical, _
Title:="Grafik formatieren"
Exit Sub
End If
Else
Set objImage = objSelection.ConvertToShape
End If
On Error GoTo 0
With objImage
.WrapFormat.Type = wdWrapNone
.LockAnchor = True
.ZOrder msoSendBehindText
End With
Set objImage = Nothing
Set objSelection = Nothing
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.