Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

Different results when using F8 and F5 in MS Word vba?

$
0
0

Hi, I'm jk.

I need to cut text in shape and paste it at the bottom of the page in very large MS Word documents.

There are lots of rectangular shapes containing texts in the document. And the average size of a document is 90MB.

-------------------------------------------------------------------------------------------------------------------

Sub ShapeTextOut()

Dim shp As Word.Shape

On Error Resume Next

Application.ScreenUpdating = False


For i = ActiveDocument.Shapes.Count To 1 Step -1
    
    ActiveDocument.Shapes(i).TextFrame.TextRange.Select
    Selection.Cut
    Selection.EscapeKey
    Selection.Collapse
    
    If Selection.Information(wdActiveEndPageNumber) < Selection.Information(wdNumberOfPagesInDocument) Then
        Selection.GoToNext wdGoToPage
        Selection.MoveLeft
    End If
    
    Selection.Paste
    
Next i

Application.ScreenUpdating = True

End Sub

-------------------------------------------------------------------------------------------------------------------

The problem is that the results of running vba sub are so different. When using F5, I got so many missing data.

 I feel uncomfortable to use F8 with the super size file and also can't trust the consequences of running F5.

I hope for an expert's advice.


Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>