Macro doesn't run on Word:mac 2011

H

hans.list

I'm trying to get this macro (that I found on the web) to run on my Mac. It gives an error in the line that starts with "strFile":

Sub DocsToDocx()
Dim strPath As String
Dim strFile As String
Dim doc As Document
' Path should end with semicolon
strPath = "SSD:Users:Hans:Dropbox:CT:prj:test:"
strFile = Dir(strPath & "*.doc") 'error here
End
Do While strFile <> ""
If Right(strFile, 3) = "doc" Then

Set doc = Documents.Open(fileName:=strPath & strFile)

If doc.HasVBProject Then
doc.SaveAs fileName:=strPath & strFile & "m", _
FileFormat:=wdFormatXMLDocumentMacroEnabled
Else
doc.SaveAs fileName:=strPath & strFile & "x", _
FileFormat:=wdFormatXMLDocument
End If
doc.Close SaveChanges:=False
End If
strFile = Dir
Loop
End Sub

How can I fix this?

Many thanks!

Hans
 
H

hans.list

Found it ...

Sub DocsToDocx()
Dim strPath As String
Dim strFile As String
Dim doc As Document
' Path should end with semicolon
strPath = "SSD:Users:Hans:Dropbox:CT:prj:test:" 'you have to set this to your own path ...
strFile = Dir(strPath, MacID("W8BN")) 'error here

Do While strFile <> ""
If Right(strFile, 3) = "doc" Then

Set doc = Documents.Open(fileName:=strPath & strFile)
doc.SaveAs fileName:=strPath & strFile & "x", _
FileFormat:=wdFormatXMLDocument

doc.Close SaveChanges:=False
End If
strFile = Dir
Loop
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top