pk247
10-16-2016, 01:03 PM
Hi Everyone,
I've been hitting my head against a brick wall with this one and was hoping someone could help me please?
The company I work for has developed a new process for generating our Word documents. It's through using TFS and once we're ready to publish to Word the document is created and then we manually tidy it up. I've manage to automate a lot of this but one thing that urks me is taking each image within the document and placing it in a new page and then resizing to a readable size. Each image has a line of text above it that needs to be carried down into the new page - and this is where my issue is. The line of text is "Normal" style but other than that I don't know how to automate the moving of the image AND the line of taxt above it into a new page for each.
I've been tweaking the following code but can't get it to work. Could someone maybe point out what I'm doing wrong please?
Sub imgnewpageTEST()
Dim x As Long
Dim oRng As Range
For x = 1 To ActiveDocument.InlineShapes.Count
Set oRng = ActiveDocument.InlineShapes(x).Range
With oRng
.MoveUp Unit:=wdLine, Count:=1, Extend:=wdMove
.MoveStart Unit:=wdLine, Count:=1
.Collapse direction:=wdCollapseStart
.InsertBreak Type:=wdPageBreak
End With
Next
End Sub
Thanks! I appreciate all the posts and help you guys have provided in the past!
Paul, IRELAND
I've been hitting my head against a brick wall with this one and was hoping someone could help me please?
The company I work for has developed a new process for generating our Word documents. It's through using TFS and once we're ready to publish to Word the document is created and then we manually tidy it up. I've manage to automate a lot of this but one thing that urks me is taking each image within the document and placing it in a new page and then resizing to a readable size. Each image has a line of text above it that needs to be carried down into the new page - and this is where my issue is. The line of text is "Normal" style but other than that I don't know how to automate the moving of the image AND the line of taxt above it into a new page for each.
I've been tweaking the following code but can't get it to work. Could someone maybe point out what I'm doing wrong please?
Sub imgnewpageTEST()
Dim x As Long
Dim oRng As Range
For x = 1 To ActiveDocument.InlineShapes.Count
Set oRng = ActiveDocument.InlineShapes(x).Range
With oRng
.MoveUp Unit:=wdLine, Count:=1, Extend:=wdMove
.MoveStart Unit:=wdLine, Count:=1
.Collapse direction:=wdCollapseStart
.InsertBreak Type:=wdPageBreak
End With
Next
End Sub
Thanks! I appreciate all the posts and help you guys have provided in the past!
Paul, IRELAND