AppleScript HTML export from Excel

Discussion in 'Mac Programming' started by superscape, Mar 26, 2018.

  1. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #1
    Hi all,

    I'm struggling with something that should be super-easy. It's probably the dreaded Curse of M****soft, but just in case it's my own stupidity (not impossible) I wondered if anyone can help me out? I'm trying to export an Excel spreadsheet as HTML. I swear the following worked in an earlier version:

    Code:
    set theFilePath to "Macintosh HD:Users:MyUserName:Desktop:blah.html"
    tell application "Microsoft Excel"
       activate
       tell active workbook
           save as active sheet filename theFilePath file format HTML file format
       end tell
    end tell
    
    ...but I'm trying to get it to work on Excel (v15.15) on High Sierra and I'm getting no errors but no output either - no file created at all.

    Interestingly, if I delete the "file format HTML file format" bit then it works and I get a spreadsheet saved.

    Any suggestions massively appreciated.

    Thanks
    r.
     
  2. superscape thread starter macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #2
    Just for the record, I never did quite get this to work. In the end, I satisfied myself with having the user copy the text to the clipboard and getting an NSAttributedString from there, which was enough for my purposes.

    Darn pesky Excel!
     

Share This Page