(Msg. 2) Posted: Fri Jul 10, 2009 4:05 am
Post subject: Re: Need VB code to batch convert wps [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
For Word 2007, there's an add-in that you can download from my web site.
For Word 2003, the following should do the trick PROVIDED you have the the
appropriate Works converter installed. You can download missing Works
converters from my web site
Sub SaveAllAsDoc()
Dim strFileName As String
Dim strDocName As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
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 & "*.wps")
While Len(strFileName) <> 0
Set oDoc = Documents.Open(strPath & strFileName)
strDocName = ActiveDocument.FullName
intPos = InStrRev(strDocName, ".")
strDocName = Left(strDocName, intPos - 1)
strDocName = strDocName & ".doc"
oDoc.SaveAs FileName:=strDocName, _
FileFormat:=0
oDoc.Close SaveChanges:=wdDoNotSaveChanges
strFileName = Dir$()
Wend
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
Bill wrote:
> Anyone have some VB code suitable for
> use with Word 2003 that can used to
> batch convert a folders worth of wps
> files to Word documents?
>
> Thanks,
> Bill
(Msg. 3) Posted: Fri Jul 10, 2009 8:45 am
Post subject: Re: Need VB code to batch convert wps [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Thanks Graham, I'll have access to my client's
machine later this evening and I'll run your code.
Are there any special VB References required
for objects you've used?
Bill
"Graham Mayor" <gmayor.RemoveThis@REMOVETHISmvps.org> wrote in message
news:eU6$q2SAKHA.3556@TK2MSFTNGP04.phx.gbl...
>
> For Word 2007, there's an add-in that you can download from my web site.
> For Word 2003, the following should do the trick PROVIDED you have the the
> appropriate Works converter installed. You can download missing Works
> converters from my web site
>
> Sub SaveAllAsDoc()
> Dim strFileName As String
> Dim strDocName As String
> Dim strPath As String
> Dim oDoc As Document
> Dim fDialog As FileDialog
> 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 & "*.wps")
> While Len(strFileName) <> 0
> Set oDoc = Documents.Open(strPath & strFileName)
> strDocName = ActiveDocument.FullName
> intPos = InStrRev(strDocName, ".")
> strDocName = Left(strDocName, intPos - 1)
> strDocName = strDocName & ".doc"
> oDoc.SaveAs FileName:=strDocName, _
> FileFormat:=0
> oDoc.Close SaveChanges:=wdDoNotSaveChanges
> strFileName = Dir$()
> Wend
> End Sub
>
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com > Word MVP web site http://word.mvps.org > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> Bill wrote:
>> Anyone have some VB code suitable for
>> use with Word 2003 that can used to
>> batch convert a folders worth of wps
>> files to Word documents?
>>
>> Thanks,
>> Bill
>
>
(Msg. 4) Posted: Sat Jul 11, 2009 1:05 am
Post subject: Re: Need VB code to batch convert wps [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
It should work with the default settings.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
Bill wrote:
> Thanks Graham, I'll have access to my client's
> machine later this evening and I'll run your code.
> Are there any special VB References required
> for objects you've used?
> Bill
>
>
> "Graham Mayor" <gmayor.RemoveThis@REMOVETHISmvps.org> wrote in message
> news:eU6$q2SAKHA.3556@TK2MSFTNGP04.phx.gbl...
>>
>> For Word 2007, there's an add-in that you can download from my web
>> site. For Word 2003, the following should do the trick PROVIDED you
>> have the the appropriate Works converter installed. You can download
>> missing Works converters from my web site
>>
>> Sub SaveAllAsDoc()
>> Dim strFileName As String
>> Dim strDocName As String
>> Dim strPath As String
>> Dim oDoc As Document
>> Dim fDialog As FileDialog
>> 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 & "*.wps")
>> While Len(strFileName) <> 0
>> Set oDoc = Documents.Open(strPath & strFileName)
>> strDocName = ActiveDocument.FullName
>> intPos = InStrRev(strDocName, ".")
>> strDocName = Left(strDocName, intPos - 1)
>> strDocName = strDocName & ".doc"
>> oDoc.SaveAs FileName:=strDocName, _
>> FileFormat:=0
>> oDoc.Close SaveChanges:=wdDoNotSaveChanges
>> strFileName = Dir$()
>> Wend
>> End Sub
>>
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com >> Word MVP web site http://word.mvps.org >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> Bill wrote:
>>> Anyone have some VB code suitable for
>>> use with Word 2003 that can used to
>>> batch convert a folders worth of wps
>>> files to Word documents?
>>>
>>> Thanks,
>>> Bill
(Msg. 5) Posted: Sat Jul 11, 2009 1:05 am
Post subject: Re: Need VB code to batch convert wps [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
I'll post back after I've had the opportunity to
access the troubled computer.
Bill
"Graham Mayor" <gmayor.DeleteThis@REMOVETHISmvps.org> wrote in message
news:unNx87dAKHA.5040@TK2MSFTNGP04.phx.gbl...
> It should work with the default settings.
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com > Word MVP web site http://word.mvps.org > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> Bill wrote:
>> Thanks Graham, I'll have access to my client's
>> machine later this evening and I'll run your code.
>> Are there any special VB References required
>> for objects you've used?
>> Bill
>>
>>
>> "Graham Mayor" <gmayor.DeleteThis@REMOVETHISmvps.org> wrote in message
>> news:eU6$q2SAKHA.3556@TK2MSFTNGP04.phx.gbl...
>>>
>>> For Word 2007, there's an add-in that you can download from my web
>>> site. For Word 2003, the following should do the trick PROVIDED you
>>> have the the appropriate Works converter installed. You can download
>>> missing Works converters from my web site
>>>
>>> Sub SaveAllAsDoc()
>>> Dim strFileName As String
>>> Dim strDocName As String
>>> Dim strPath As String
>>> Dim oDoc As Document
>>> Dim fDialog As FileDialog
>>> 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 & "*.wps")
>>> While Len(strFileName) <> 0
>>> Set oDoc = Documents.Open(strPath & strFileName)
>>> strDocName = ActiveDocument.FullName
>>> intPos = InStrRev(strDocName, ".")
>>> strDocName = Left(strDocName, intPos - 1)
>>> strDocName = strDocName & ".doc"
>>> oDoc.SaveAs FileName:=strDocName, _
>>> FileFormat:=0
>>> oDoc.Close SaveChanges:=wdDoNotSaveChanges
>>> strFileName = Dir$()
>>> Wend
>>> End Sub
>>>
>>>
>>> --
>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>> Graham Mayor - Word MVP
>>>
>>> My web site www.gmayor.com >>> Word MVP web site http://word.mvps.org >>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>>
>>>
>>> Bill wrote:
>>>> Anyone have some VB code suitable for
>>>> use with Word 2003 that can used to
>>>> batch convert a folders worth of wps
>>>> files to Word documents?
>>>>
>>>> Thanks,
>>>> Bill
>
>
(Msg. 6) Posted: Sun Jul 12, 2009 10:16 pm
Post subject: Re: Need VB code to batch convert wps [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Code worked great. Turned out that my
client had W2002 installed and inserting
your code in a general module and running
from Debug easily converted all 218 wps
files to doc files of the same name.
Many thanks.
Bill
"Graham Mayor" <gmayor RemoveThis @REMOVETHISmvps.org> wrote in message
news:eU6$q2SAKHA.3556@TK2MSFTNGP04.phx.gbl...
>
> For Word 2007, there's an add-in that you can download from my web site.
> For Word 2003, the following should do the trick PROVIDED you have the the
> appropriate Works converter installed. You can download missing Works
> converters from my web site
>
> Sub SaveAllAsDoc()
> Dim strFileName As String
> Dim strDocName As String
> Dim strPath As String
> Dim oDoc As Document
> Dim fDialog As FileDialog
> 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 & "*.wps")
> While Len(strFileName) <> 0
> Set oDoc = Documents.Open(strPath & strFileName)
> strDocName = ActiveDocument.FullName
> intPos = InStrRev(strDocName, ".")
> strDocName = Left(strDocName, intPos - 1)
> strDocName = strDocName & ".doc"
> oDoc.SaveAs FileName:=strDocName, _
> FileFormat:=0
> oDoc.Close SaveChanges:=wdDoNotSaveChanges
> strFileName = Dir$()
> Wend
> End Sub
>
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com > Word MVP web site http://word.mvps.org > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> Bill wrote:
>> Anyone have some VB code suitable for
>> use with Word 2003 that can used to
>> batch convert a folders worth of wps
>> files to Word documents?
>>
>> Thanks,
>> Bill
>
>
(Msg. 7) Posted: Mon Jul 13, 2009 6:05 am
Post subject: Re: Need VB code to batch convert wps [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
You are welcome to donate a portion of your fee from the client to my
website
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
Bill wrote:
> Code worked great. Turned out that my
> client had W2002 installed and inserting
> your code in a general module and running
> from Debug easily converted all 218 wps
> files to doc files of the same name.
>
> Many thanks.
> Bill
>
> "Graham Mayor" <gmayor.TakeThisOut@REMOVETHISmvps.org> wrote in message
> news:eU6$q2SAKHA.3556@TK2MSFTNGP04.phx.gbl...
>>
>> For Word 2007, there's an add-in that you can download from my web
>> site. For Word 2003, the following should do the trick PROVIDED you
>> have the the appropriate Works converter installed. You can download
>> missing Works converters from my web site
>>
>> Sub SaveAllAsDoc()
>> Dim strFileName As String
>> Dim strDocName As String
>> Dim strPath As String
>> Dim oDoc As Document
>> Dim fDialog As FileDialog
>> 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 & "*.wps")
>> While Len(strFileName) <> 0
>> Set oDoc = Documents.Open(strPath & strFileName)
>> strDocName = ActiveDocument.FullName
>> intPos = InStrRev(strDocName, ".")
>> strDocName = Left(strDocName, intPos - 1)
>> strDocName = strDocName & ".doc"
>> oDoc.SaveAs FileName:=strDocName, _
>> FileFormat:=0
>> oDoc.Close SaveChanges:=wdDoNotSaveChanges
>> strFileName = Dir$()
>> Wend
>> End Sub
>>
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com >> Word MVP web site http://word.mvps.org >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> Bill wrote:
>>> Anyone have some VB code suitable for
>>> use with Word 2003 that can used to
>>> batch convert a folders worth of wps
>>> files to Word documents?
>>>
>>> Thanks,
>>> Bill
(Msg. 8) Posted: Mon Jul 13, 2009 7:05 am
Post subject: Re:Need VB code to batch convert wps [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
All times are: Eastern Time (US & Canada) (change) Goto page 1, 2
Page 1 of 2
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum