Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
"Save as" for multiple documents
Hi
Is there a way to automatically do a "save as" to multiple documents, found in a single folder, while being able to specify the "Save as type"? For example, I may one time need to save them as *.txt, other time as *.dot,... anything that goes under the "save as type" list. Thanks |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
"Save as" for multiple documents
Modify the code in the article "Find & ReplaceAll on a batch of documents in
the same folder" at: http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm by deleting all the Find and Replace stuff and just changing the way that the file is saved. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "daves" wrote in message ... Hi Is there a way to automatically do a "save as" to multiple documents, found in a single folder, while being able to specify the "Save as type"? For example, I may one time need to save them as *.txt, other time as *.dot,... anything that goes under the "save as type" list. Thanks |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
"Save as" for multiple documents
hmmm, maybe I should have posted my question in the "New Users" section ;-)
"Doug Robbins - Word MVP" wrote: Modify the code in the article "Find & ReplaceAll on a batch of documents in the same folder" at: http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm by deleting all the Find and Replace stuff and just changing the way that the file is saved. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "daves" wrote in message ... Hi Is there a way to automatically do a "save as" to multiple documents, found in a single folder, while being able to specify the "Save as type"? For example, I may one time need to save them as *.txt, other time as *.dot,... anything that goes under the "save as type" list. Thanks |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
"Save as" for multiple documents
vba.beginners or any of the vba newsgroups would be better.
-- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "daves" wrote in message ... hmmm, maybe I should have posted my question in the "New Users" section ;-) "Doug Robbins - Word MVP" wrote: Modify the code in the article "Find & ReplaceAll on a batch of documents in the same folder" at: http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm by deleting all the Find and Replace stuff and just changing the way that the file is saved. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "daves" wrote in message ... Hi Is there a way to automatically do a "save as" to multiple documents, found in a single folder, while being able to specify the "Save as type"? For example, I may one time need to save them as *.txt, other time as *.dot,... anything that goes under the "save as type" list. Thanks |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
"Save as" for multiple documents
The following will allow you to save a folder of Word documents in a number
of common formats. The numbers are those associated with the particular file types and not an indication that I cannot count Sub SaveAllAsType() Dim strFileName As String Dim strDocName As String Dim strPath As String Dim oDoc As Document Dim Response As Long Dim fDialog As FileDialog Dim sTypeNo As Integer Dim sExt As String sTypeNo = InputBox("Save documents in which format?" & vbCr & _ " 0 = Microsoft Office Word format." & vbCr & _ " 2 = Microsoft Windows text format." & vbCr & _ " 4 = Microsoft DOS text format." & vbCr & _ " 5 = Microsoft DOS text with line breaks preserved." & vbCr & _ " 6 = Rich text format (RTF)." & vbCr & _ " 8 = Standard HTML format." & vbCr & _ "10 = Filtered HTML format." & vbCr & vbCr & _ "Enter the number associated with the file type", "File Type", 2) Select Case sTypeNo Case Is = "0" sExt = ".doc" Case Is = "2" sExt = ".txt" Case Is = "4" sExt = ".txt" Case Is = "5" sExt = ".txt" Case Is = "6" sExt = ".rtf" Case Is = "8" sExt = ".html" Case Is = "10" sExt = ".html" Case Else MsgBox "Incorrect number selected", vbExclamation Exit Sub End Select Set fDialog = Application.FileDialog(msoFileDialogFolderPicker) With fDialog .Title = "Select folder and click OK" .AllowMultiSelect = False .InitialView = msoFileDialogViewList If .Show -1 Then MsgBox "Cancelled By User", , "Save all" Exit Sub End If strPath = fDialog.SelectedItems.Item(1) If Right(strPath, 1) "\" Then strPath = strPath + "\" End With If Documents.Count 0 Then Documents.Close SaveChanges:=wdPromptToSaveChanges End If strFileName = Dir$(strPath & "*.doc") While Len(strFileName) 0 Set oDoc = Documents.Open(strPath & strFileName) strDocName = ActiveDocument.FullName intPos = InStrRev(strDocName, ".") strDocName = Left(strDocName, intPos - 1) strDocName = strDocName & sExt oDoc.SaveAs FileName:=strDocName, _ FileFormat:=sTypeNo oDoc.Close SaveChanges:=wdDoNotSaveChanges strFileName = Dir$() Wend End Sub http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org daves wrote: hmmm, maybe I should have posted my question in the "New Users" section ;-) "Doug Robbins - Word MVP" wrote: Modify the code in the article "Find & ReplaceAll on a batch of documents in the same folder" at: http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm by deleting all the Find and Replace stuff and just changing the way that the file is saved. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "daves" wrote in message ... Hi Is there a way to automatically do a "save as" to multiple documents, found in a single folder, while being able to specify the "Save as type"? For example, I may one time need to save them as *.txt, other time as *.dot,... anything that goes under the "save as type" list. Thanks |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
"Save as" for multiple documents
Thank you guys for your help. It worked. Much obliged.
"Graham Mayor" wrote: The following will allow you to save a folder of Word documents in a number of common formats. The numbers are those associated with the particular file types and not an indication that I cannot count Sub SaveAllAsType() Dim strFileName As String Dim strDocName As String Dim strPath As String Dim oDoc As Document Dim Response As Long Dim fDialog As FileDialog Dim sTypeNo As Integer Dim sExt As String sTypeNo = InputBox("Save documents in which format?" & vbCr & _ " 0 = Microsoft Office Word format." & vbCr & _ " 2 = Microsoft Windows text format." & vbCr & _ " 4 = Microsoft DOS text format." & vbCr & _ " 5 = Microsoft DOS text with line breaks preserved." & vbCr & _ " 6 = Rich text format (RTF)." & vbCr & _ " 8 = Standard HTML format." & vbCr & _ "10 = Filtered HTML format." & vbCr & vbCr & _ "Enter the number associated with the file type", "File Type", 2) Select Case sTypeNo Case Is = "0" sExt = ".doc" Case Is = "2" sExt = ".txt" Case Is = "4" sExt = ".txt" Case Is = "5" sExt = ".txt" Case Is = "6" sExt = ".rtf" Case Is = "8" sExt = ".html" Case Is = "10" sExt = ".html" Case Else MsgBox "Incorrect number selected", vbExclamation Exit Sub End Select Set fDialog = Application.FileDialog(msoFileDialogFolderPicker) With fDialog .Title = "Select folder and click OK" .AllowMultiSelect = False .InitialView = msoFileDialogViewList If .Show -1 Then MsgBox "Cancelled By User", , "Save all" Exit Sub End If strPath = fDialog.SelectedItems.Item(1) If Right(strPath, 1) "\" Then strPath = strPath + "\" End With If Documents.Count 0 Then Documents.Close SaveChanges:=wdPromptToSaveChanges End If strFileName = Dir$(strPath & "*.doc") While Len(strFileName) 0 Set oDoc = Documents.Open(strPath & strFileName) strDocName = ActiveDocument.FullName intPos = InStrRev(strDocName, ".") strDocName = Left(strDocName, intPos - 1) strDocName = strDocName & sExt oDoc.SaveAs FileName:=strDocName, _ FileFormat:=sTypeNo oDoc.Close SaveChanges:=wdDoNotSaveChanges strFileName = Dir$() Wend End Sub http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org daves wrote: hmmm, maybe I should have posted my question in the "New Users" section ;-) "Doug Robbins - Word MVP" wrote: Modify the code in the article "Find & ReplaceAll on a batch of documents in the same folder" at: http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm by deleting all the Find and Replace stuff and just changing the way that the file is saved. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "daves" wrote in message ... Hi Is there a way to automatically do a "save as" to multiple documents, found in a single folder, while being able to specify the "Save as type"? For example, I may one time need to save them as *.txt, other time as *.dot,... anything that goes under the "save as type" list. Thanks |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
"Save as" for multiple documents
The nice thing about this code is that with slight changes one can add other
formats included in the Word SaveAs list. Also, one can make a conversion back to .doc with the correct modification of the code. Thanks again. "daves" wrote: Thank you guys for your help. It worked. Much obliged. "Graham Mayor" wrote: The following will allow you to save a folder of Word documents in a number of common formats. The numbers are those associated with the particular file types and not an indication that I cannot count Sub SaveAllAsType() Dim strFileName As String Dim strDocName As String Dim strPath As String Dim oDoc As Document Dim Response As Long Dim fDialog As FileDialog Dim sTypeNo As Integer Dim sExt As String sTypeNo = InputBox("Save documents in which format?" & vbCr & _ " 0 = Microsoft Office Word format." & vbCr & _ " 2 = Microsoft Windows text format." & vbCr & _ " 4 = Microsoft DOS text format." & vbCr & _ " 5 = Microsoft DOS text with line breaks preserved." & vbCr & _ " 6 = Rich text format (RTF)." & vbCr & _ " 8 = Standard HTML format." & vbCr & _ "10 = Filtered HTML format." & vbCr & vbCr & _ "Enter the number associated with the file type", "File Type", 2) Select Case sTypeNo Case Is = "0" sExt = ".doc" Case Is = "2" sExt = ".txt" Case Is = "4" sExt = ".txt" Case Is = "5" sExt = ".txt" Case Is = "6" sExt = ".rtf" Case Is = "8" sExt = ".html" Case Is = "10" sExt = ".html" Case Else MsgBox "Incorrect number selected", vbExclamation Exit Sub End Select Set fDialog = Application.FileDialog(msoFileDialogFolderPicker) With fDialog .Title = "Select folder and click OK" .AllowMultiSelect = False .InitialView = msoFileDialogViewList If .Show -1 Then MsgBox "Cancelled By User", , "Save all" Exit Sub End If strPath = fDialog.SelectedItems.Item(1) If Right(strPath, 1) "\" Then strPath = strPath + "\" End With If Documents.Count 0 Then Documents.Close SaveChanges:=wdPromptToSaveChanges End If strFileName = Dir$(strPath & "*.doc") While Len(strFileName) 0 Set oDoc = Documents.Open(strPath & strFileName) strDocName = ActiveDocument.FullName intPos = InStrRev(strDocName, ".") strDocName = Left(strDocName, intPos - 1) strDocName = strDocName & sExt oDoc.SaveAs FileName:=strDocName, _ FileFormat:=sTypeNo oDoc.Close SaveChanges:=wdDoNotSaveChanges strFileName = Dir$() Wend End Sub http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org daves wrote: hmmm, maybe I should have posted my question in the "New Users" section ;-) "Doug Robbins - Word MVP" wrote: Modify the code in the article "Find & ReplaceAll on a batch of documents in the same folder" at: http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm by deleting all the Find and Replace stuff and just changing the way that the file is saved. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "daves" wrote in message ... Hi Is there a way to automatically do a "save as" to multiple documents, found in a single folder, while being able to specify the "Save as type"? For example, I may one time need to save them as *.txt, other time as *.dot,... anything that goes under the "save as type" list. Thanks |
#8
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
"Save as" for multiple documents
You are welcome
-- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org daves wrote: The nice thing about this code is that with slight changes one can add other formats included in the Word SaveAs list. Also, one can make a conversion back to .doc with the correct modification of the code. Thanks again. "daves" wrote: Thank you guys for your help. It worked. Much obliged. "Graham Mayor" wrote: The following will allow you to save a folder of Word documents in a number of common formats. The numbers are those associated with the particular file types and not an indication that I cannot count Sub SaveAllAsType() Dim strFileName As String Dim strDocName As String Dim strPath As String Dim oDoc As Document Dim Response As Long Dim fDialog As FileDialog Dim sTypeNo As Integer Dim sExt As String sTypeNo = InputBox("Save documents in which format?" & vbCr & _ " 0 = Microsoft Office Word format." & vbCr & _ " 2 = Microsoft Windows text format." & vbCr & _ " 4 = Microsoft DOS text format." & vbCr & _ " 5 = Microsoft DOS text with line breaks preserved." & vbCr & _ " 6 = Rich text format (RTF)." & vbCr & _ " 8 = Standard HTML format." & vbCr & _ "10 = Filtered HTML format." & vbCr & vbCr & _ "Enter the number associated with the file type", "File Type", 2) Select Case sTypeNo Case Is = "0" sExt = ".doc" Case Is = "2" sExt = ".txt" Case Is = "4" sExt = ".txt" Case Is = "5" sExt = ".txt" Case Is = "6" sExt = ".rtf" Case Is = "8" sExt = ".html" Case Is = "10" sExt = ".html" Case Else MsgBox "Incorrect number selected", vbExclamation Exit Sub End Select Set fDialog = Application.FileDialog(msoFileDialogFolderPicker) With fDialog .Title = "Select folder and click OK" .AllowMultiSelect = False .InitialView = msoFileDialogViewList If .Show -1 Then MsgBox "Cancelled By User", , "Save all" Exit Sub End If strPath = fDialog.SelectedItems.Item(1) If Right(strPath, 1) "\" Then strPath = strPath + "\" End With If Documents.Count 0 Then Documents.Close SaveChanges:=wdPromptToSaveChanges End If strFileName = Dir$(strPath & "*.doc") While Len(strFileName) 0 Set oDoc = Documents.Open(strPath & strFileName) strDocName = ActiveDocument.FullName intPos = InStrRev(strDocName, ".") strDocName = Left(strDocName, intPos - 1) strDocName = strDocName & sExt oDoc.SaveAs FileName:=strDocName, _ FileFormat:=sTypeNo oDoc.Close SaveChanges:=wdDoNotSaveChanges strFileName = Dir$() Wend End Sub http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org daves wrote: hmmm, maybe I should have posted my question in the "New Users" section ;-) "Doug Robbins - Word MVP" wrote: Modify the code in the article "Find & ReplaceAll on a batch of documents in the same folder" at: http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm by deleting all the Find and Replace stuff and just changing the way that the file is saved. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "daves" wrote in message ... Hi Is there a way to automatically do a "save as" to multiple documents, found in a single folder, while being able to specify the "Save as type"? For example, I may one time need to save them as *.txt, other time as *.dot,... anything that goes under the "save as type" list. Thanks |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
email merge with multiple recipients in "To", "CC" & "BCC" | Mailmerge | |||
I can't "Open" a downloaded template. Only "Save" and "Cancel" | Microsoft Word Help | |||
Folder or file details pop-up in "save" or "open" dialog boxes. | Microsoft Word Help | |||
How do I delete names of old documents from "save as" history? | Microsoft Word Help | |||
Word shows "save" and "save" in drop down menu- no "save as" | Microsoft Word Help |