Macro doesn't run on Word:mac 2011

Discussion in 'Word VBA' started by hans.list@gmail.com, Oct 27, 2013.

  1. Guest

    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
     
    , Oct 27, 2013
    #1
    1. Advertisements

  2. Guest

    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
     
    , Oct 27, 2013
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Vivian Carroll

    Shortcut key doesn't run macro properly

    Vivian Carroll, Feb 19, 2004, in forum: Word VBA
    Replies:
    6
    Views:
    140
    Vivian Carroll
    Feb 25, 2004
  2. John Bacon

    AutoNew macro doesn't run

    John Bacon, Jan 12, 2006, in forum: Word VBA
    Replies:
    2
    Views:
    253
    pkovacevic
    Oct 10, 2007
  3. Nat81
    Replies:
    8
    Views:
    198
    Nat81
    Mar 13, 2006
  4. SandiK
    Replies:
    4
    Views:
    203
    Dian D. Chapman, MVP
    Oct 31, 2006
  5. Bob W

    AutoOpen macro doesn't run

    Bob W, May 13, 2008, in forum: Word VBA
    Replies:
    3
    Views:
    141
    fumei via OfficeKB.com
    May 13, 2008
  6. Gary Hillerson

    Documentation for VBA on new Word 2011

    Gary Hillerson, Oct 28, 2010, in forum: Word VBA
    Replies:
    0
    Views:
    246
    Gary Hillerson
    Oct 28, 2010
  7. Larry Sulky

    Word 2011 templates and toolbars

    Larry Sulky, Jan 7, 2011, in forum: Word VBA
    Replies:
    4
    Views:
    242
  8. Harry
    Replies:
    0
    Views:
    212
    Harry
    Apr 13, 2011
Loading...