![]() |
#3
|
|||
|
|||
![]()
Paul,
Thanks. Poor description of the problem on my end. I realized that it was the repositioning steps that were failing. What I was looking for is some understanding of why if fails? Why it fails if 1) starting with the selection in the first page content and not if in the odd page content and 2) why if fails when running the code and not if stepping through. Code:
Private Sub DemoIssue() Dim oRngStart As Range Dim lngIndex As Long, lngSect Application.ScreenUpdating = False For Each oSec In ActiveDocument.Sections For lngIndex = 1 To 3 Set oRng = oSec.Headers(lngIndex).Range For Each oShp In oRng.ShapeRange If InStr(oShp.Name, "PrivBox_") = 1 Then oShp.Delete Next Next lngIndex Next oSec For Each oSec In ActiveDocument.Sections For lngIndex = 1 To 3 If Not oSec.Headers(wdHeaderFooterPrimary).LinkToPrevious Then InsertBox lngIndex If lngIndex = 1 Then Set oShpDup = oShp 'DoEvents End If Next lngIndex Next oSec 'But why does it fail? Using the origianal position 337.05, 72.2, 207#, 27# in the InsertBox procedure 'Run the code with this Stop 'Stop 'Then step through and the Odd page is positioned correctly. 'Remove the stop ans run the code. With oShpDup Debug.Print .Left & " - " & .Top .RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn .RelativeVerticalPosition = wdRelativeVerticalPositionParagraph .Left = InchesToPoints(3.68) .Top = InchesToPoints(0) Debug.Print .Left & " - " & .Top End With Application.ScreenUpdating = True Application.ScreenRefresh lbl_Exit: Exit Sub End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Image imported into word Shape is smaller than the shape and not centered | drwin | Drawing and Graphics | 1 | 09-21-2023 11:33 AM |
Get the position of a string from the cursor position forward | alex100 | Word VBA | 2 | 02-22-2023 02:48 AM |
When I copy a shape into another document it becomes a picture. I want a shape. | FJM | Word | 4 | 02-24-2022 09:59 AM |
Puzzling behavior by Window shape in [Walls, Shell and Structure] | csdlman | Visio | 3 | 06-12-2018 03:50 AM |
Textboxes position isn't equal to initial position | dxdevil | Word VBA | 0 | 01-30-2017 04:32 AM |