Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
DaveS DaveS is offline
external usenet poster
 
Posts: 6
Default "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   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default "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   Report Post  
Posted to microsoft.public.word.docmanagement
DaveS DaveS is offline
external usenet poster
 
Posts: 6
Default "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   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default "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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default "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   Report Post  
Posted to microsoft.public.word.docmanagement
DaveS DaveS is offline
external usenet poster
 
Posts: 6
Default "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   Report Post  
Posted to microsoft.public.word.docmanagement
DaveS DaveS is offline
external usenet poster
 
Posts: 6
Default "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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default "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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
email merge with multiple recipients in "To", "CC" & "BCC" Raghu Mailmerge 6 April 21st 23 12:58 PM
I can't "Open" a downloaded template. Only "Save" and "Cancel" Dave Microsoft Word Help 1 April 4th 08 02:28 PM
Folder or file details pop-up in "save" or "open" dialog boxes. GW Microsoft Word Help 2 November 18th 06 08:27 AM
How do I delete names of old documents from "save as" history? rilry5351 Microsoft Word Help 0 August 23rd 06 04:06 AM
Word shows "save" and "save" in drop down menu- no "save as" JenniferK Microsoft Word Help 4 May 26th 06 06:21 PM


All times are GMT +1. The time now is 03:47 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"