• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Ruby saveas .XLSM, format code

Scheduled Pinned Locked Moved Developers' Forum
5 Posts 3 Posters 1.5k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    davesexcel
    last edited by 26 Jan 2017, 13:42

    I thought 52 was the code to save as an .xlsm file, but I get an UndefinedConversionError.

    
    workbook.SaveAs("C;\TestFolder\TestAddImage.xlsm",52)
    
    
    1 Reply Last reply Reply Quote 0
    • S Offline
      slbaumgartner
      last edited by 26 Jan 2017, 16:03

      Did you accidentally post in the wrong forum? There is no workbook object and no SaveAs method in SketchUp or in native Ruby...

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 27 Jan 2017, 12:26

        No Steve, he's fine. He uses the Ruby standard WIN32OLE library to connect SketchUp with Excel workbooks.

        This library basically exposes the VBA object model of Excel to Ruby. SO he's attempting to make a OLE call to Excel's VBA "SaveAs" method.

        This is the entry page for the Excel VBA object model:
        https://msdn.microsoft.com/en-us/library/ff194068.aspx

        This page coves the Workbook object:
        https://msdn.microsoft.com/en-us/library/ff835568.aspx

        This page is for the Workbook.SaveAs method:
        https://msdn.microsoft.com/en-us/library/ff841185.aspx

        This page is for the XlFileFormat Enumeration, whose members are to be used in the 2nd argument to Workbook.SaveAs:
        https://msdn.microsoft.com/en-us/library/ff198017.aspx

        The XLSM format came out in 2007.
        But has it been superseded in newer Office versions ?

        List of Microsoft Office filename extensions:
        https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions

        Office Open XML (Microsoft invented standard, and copyright holder.)
        https://en.wikipedia.org/wiki/Office_Open_XML


        Not to be confused with:

        OpenOffice.org XML (obsolete, superseded by OpenDocument):
        https://en.wikipedia.org/wiki/OpenOffice.org_XML

        OpenDocument (The FREE international standard):
        https://en.wikipedia.org/wiki/OpenDocument

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • D Offline
          Dan Rathbun
          last edited by 27 Jan 2017, 12:40

          @davesexcel said:

          I thought 52 was the code to save as an .xlsm file, but I get an UndefinedConversionError.

          
          > workbook.SaveAs("C;\TestFolder\TestAddImage.xlsm",52)
          > 
          

          As a general rule, try to use the interface's constants rather than direct use of integers. (The integers could change in the future and break your code.)


          Microsoft forums:

          Excel for Developers:
          https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=exceldev%26amp;filter=alltypes%26amp;sort=lastpostdesc

          Open XML Format SDK
          https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=oxmlsdk%26amp;filter=alltypes%26amp;sort=lastpostdesc

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • D Offline
            Dan Rathbun
            last edited by 27 Jan 2017, 12:49

            I did a search in the MS Excel Dev forum on "+SaveAs +xlsm +UndefinedConversionError", and got 947 hits. (You can browse those yourself.)

            https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=exceldev%26amp;filter=alltypes%26amp;brandIgnore=True%26amp;sort=relevancedesc%26amp;filter=alltypes%26amp;searchTerm=%2BSaveAs+%2Bxlsm+%2BUndefinedConversionError

            At this point I would double-check that any macros in the Workbook do not have errors, that could give the file export routine issues.

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              1/5
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement