![]() |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
Dear all,
I have a large file around 1300 pages and wanted to split by pages and also change file formate as HTML but getting error. My Macro script is, Sub BreakOnPage() ' Used to set criteria for moving through the document by page. Application.Browser.Target = wdBrowsePage For i = 1 To ActiveDocument.BuiltInDocumentProperties("Number of Pages") 'Select and copy the text to the clipboard ActiveDocument.Bookmarks("\page").Range.Copy ' Open new document to paste the content of the clipboard into. Documents.Add Selection.Paste ' Removes the break that is copied at the end of the page, if any. Selection.TypeBackspace ChangeFileOpenDirectory "C:" DocNum = DocNum + 1 ActiveDocument.SaveAs FileName:="page_" & DocNum & ".html ActiveDocument.Close ' Move the selection to the next page in the document Application.Browser.Next Next i ActiveDocument.Close savechanges:=wdDoNotSaveChanges End Sub Aprreciated for your help. |
Tags |
error 5156, macro assign word, split and convert html |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
adikrak | Word VBA | 7 | 01-02-2020 02:52 PM |
Help Please: New VBA user trying to use a macro to split Mail Merge documents. Two Run-Time Error | zipit189 | Word VBA | 7 | 03-18-2015 01:13 PM |
Ongoing Nightmare - Opening a .txt. or .csv containing HTML script | freshfrost | Excel | 4 | 09-28-2014 12:23 AM |
![]() |
MikS | Word | 3 | 06-12-2012 05:39 AM |
Convert a file from HTML to WORD format weblayout view | gtselvam | Word | 0 | 12-02-2008 03:53 AM |