Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-20-2017, 09:08 PM
gmayor's Avatar
gmayor gmayor is offline set headings in a VBA inserted text to use for index Windows 10 set headings in a VBA inserted text to use for index Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The problem is that you are pasting the items after the range and then formatting the range. Without your workbook it is impossible to check, but the following should be closer:
Code:
For i = 6 To Sheets.Count

    range2.Collapse direction:=0
    range2.Style = "kop 2"
    Worksheets(i).Range("AU20").Copy
    Application.Wait (Now + TimeValue("0:00:01"))
    range2.PasteSpecial Placement:=0, DataType:=2
    appwd.ActiveDocument.Range.InsertParagraphAfter
    range2.End = appwd.ActiveDocument.Range.End
    range2.Paragraphs(1).Style = "kop 2"
    Application.CutCopyMode = False


    'copy paste acties
    For j = 1 To 6
        range2.Collapse direction:=0
        Worksheets(i).Range(bereik(j)).Copy
        Application.Wait (Now + TimeValue("0:00:01"))
        range2.PasteSpecial Placement:=0, DataType:=3
        appwd.ActiveDocument.Range.InsertParagraphAfter
        range2.End = appwd.ActiveDocument.Range.End
        range2.Paragraphs(1).Style = "standaard"
        Application.CutCopyMode = False
    Next j

Next i
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
set headings in a VBA inserted text to use for index Underline Inserted Text jmltinc Word VBA 9 02-08-2017 08:10 AM
align text when textbox inserted later ketanco Word 1 06-19-2016 01:21 PM
set headings in a VBA inserted text to use for index Is there a way of having text automatically inserted based on the selection of other text? MiniMum97 Word 2 04-12-2016 06:09 AM
Text disappears (but headings and text boxes ok) when printing 1 page of a document msfordummies Word 1 02-21-2013 10:28 PM
Automatic text on inserted slides tom_kladno PowerPoint 0 05-12-2011 04:30 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:07 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft