Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-10-2020, 05:12 AM
kishan patel kishan patel is offline I got error for Macro script when I used for split large file and convert as HTML Windows 10 I got error for Macro script when I used for split large file and convert as HTML Office 2019
Novice
I got error for Macro script when I used for split large file and convert as HTML
 
Join Date: Oct 2020
Posts: 2
kishan patel is on a distinguished road
Post I got error for Macro script when I used for split large file and convert as HTML

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.
Reply With Quote
 

Tags
error 5156, macro assign word, split and convert html



Similar Threads
Thread Thread Starter Forum Replies Last Post
I got error for Macro script when I used for split large file and convert as HTML DOCX TO HTML - script writing 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
I got error for Macro script when I used for split large file and convert as HTML Convert word files to html including hyperlink file types 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

Other Forums: Access Forums

All times are GMT -7. The time now is 06:35 AM.


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