View Single Post
 
Old 07-28-2014, 10:18 PM
QA_Compliance_Advisor QA_Compliance_Advisor is offline Windows 7 32bit Office 2007
Advanced Beginner
 
Join Date: Jul 2014
Posts: 44
QA_Compliance_Advisor is on a distinguished road
Default

I set up a new thread as i thought the old one would be dead

Sub ConvertFiles()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, wdDoc As Document
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
While strFile <> ""
If InStrRev(strFile, ".docx") = 0 Then
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, _
AddToRecentFiles:=False, Visible:=False)
wdDoc.SaveAs2 FileName:=strFolder & "\" & Left(strFile, InStrRev(strFile, ".doc")) & "docx", _
Fileformat:=wdFormatXMLDocument, AddToRecentFiles:=False
wdDoc.Close SaveChanges:=False
End If
strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub

Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder( 0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function

However I am getting an error "Run-time error '438': object doesn't support this property or method"

could someone advise where I might be going wrong - the pink text is being highlighted when I debug.


Last edited by QA_Compliance_Advisor; 07-28-2014 at 11:47 PM. Reason: Thread consolidation
Reply With Quote