![]() |
|
#3
|
|||
|
|||
|
Thanks, but it looks like I may not have been perfectly clear.
I need a macro to open every HTM or HTML file in a specific folder and convert them all, saved in the same folder with the original file name. I have part of the VBA enough to open and close the files throughout the directory (copied from a macro from another process of mine), but am missing the steps to save a copy as a Word doc. The "Call to SaveAsDocx" part is what I can't figure out. Code:
Sub ConvertHTMLtoDOC() Dim file Dim path As String ' Path to your folder. Make SURE you include the terminating "\" 'YOU MUST EDIT THIS. path = "\\MYPATH" 'Change this file extension to the file you are opening. .htm is listed below. 'YOU MAY NEED TO EDIT THIS. file = Dir(path & "*.htm*") Do While file <> "" Documents.Open FileName:=path & file ' This is the call to the macro you want to run on each file the folder Call SaveAsDocx ActiveDocument.Close ' set file to next in Dir file = Dir() Loop End Sub |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
save dialog box promt doesn't save file
|
brmveen | Word VBA | 2 | 11-04-2015 12:51 AM |
Word 2007 , when I save a .doc or .docx file the file type is showing "Empty"
|
Tomc29 | Word | 9 | 06-10-2015 03:04 AM |
| Set File Type when clicking Save As | Madbags | Word VBA | 1 | 10-10-2014 01:07 PM |
Word file type in 2007
|
casaserves | Word | 4 | 08-03-2013 01:11 AM |
| Getting COMException Incompatible file type and file extension | sbalerao | Mail Merge | 0 | 04-21-2011 10:30 AM |