----------------------------------------------------------------------------------------------------------------------------
Hi Santosh, I know I'm late but hope this helps to you !! Sub CopyWorksheetsToWord() ' requires a reference to the Word Object library: ' in the VBE select Tools, References and check the Microsoft Word X.X object library On Error Resume Next Dim wdApp As Word.Application, wdDoc As Word.Document, ws As Worksheet Application.ScreenUpdating = False Application.StatusBar = "Creating new document..." Set wdApp = New Word.Application Set wdDoc = wdApp.Documents.Add For Each ws In ActiveWorkbook.Worksheets Application.StatusBar = "Copying data from " & ws.Name & "..." ws.UsedRange.Copy ' or edit to the range you want to copy wdDoc.Paragraphs (wdDoc.Paragraphs.count).Range.InsertParagraphAfter wdDoc.Paragraphs(wdDoc.Paragraphs.count).Range.Paste Application.CutCopyMode = False wdDoc.Paragraphs (wdDoc.Paragraphs.count).Range.InsertParagraphAfter ' insert page break after all worksheets except the last one If Not ws.Name = Worksheets(Worksheets.count).Name Then With wdDoc.Paragraphs(wdDoc.Paragraphs.count).Range .InsertParagraphBefore .Collapse Direction:=wdCollapseEnd .InsertBreak Type:=wdPageBreak End With End If Next ws Set ws = Nothing Application.StatusBar = "Cleaning up..." ' apply normal view With wdApp.ActiveWindow If .View.SplitSpecial = wdPaneNone Then .ActivePane.View.Type = wdNormalView Else .View.Type = wdNormalView End If End With Set wdDoc = Nothing wdApp.Visible = True Set wdApp = Nothing Application.StatusBar = False On Error GoTo 0 End Sub For more tips, tricks, downloads and problem solutions: visit --> http://www.excelitems.com ------------------------------------------------------------------------ Regards *Ashish **Jain* Analyst and Demand-Co-ordinator, CSC Australia Microsoft Certified Application (Excel) Specialist Technical Trainer - Excel and VBA Author -> www.excelitems.com 09999-40-48-43 ---------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------- On Feb 15, 6:36 pm, santosh avkr <avkr.sant...@gmail.com> wrote: > hi all > > I am rookie to VBA.I need a macro which takes the Heading name as input and > Exports the contents of the heading into a new word > document<http://www.xtremevbtalk.com/showthread.php?t=304610>.I > am new to VBA but it is extremely important as i have to submit it by > tomorrow me plzzzzzz help me. --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---