1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Could anyone give advice with using AttachToExcel

Discussion in 'Alibre Script' started by idslk, Apr 5, 2019.

  1. idslk

    idslk Alibre Super User

    Hello Colleagues,

    Is anyone out there, who knows how to use this function?

    If i use ParameterTypes.Distance i get:
    System.Runtime.InteropServices.COMException (0x80040310): Invalid length unit given for distance parameter
    If i use ParameterUnits.Centimeters i get:
    Microsoft.Scripting.ArgumentTypeException: expected ParameterTypes, got ParameterUnits

    There is only one number in the used Excelfile in Cell 'A1'.

  2. oldfox

    oldfox Alibre Super User

    Hi Stefan, have you tried: ParameterTypesUnits.Centimeters ?
  3. idslk

    idslk Alibre Super User

    Hello Chris,

    thanks for your reply, read it and tested it a few moments ago...no luck...:(

  4. oldfox

    oldfox Alibre Super User

    Well, that's all I had. Really a shot in the dark. Hope you find something that works.
  5. NateLiqGrav

    NateLiqGrav Alibre Super User

    I couldn't get it to work either.
  6. simonb65

    simonb65 Alibre Super User

    Sounds like a question for @ajayre (a.k.a The Script Guru)!
  7. idslk

    idslk Alibre Super User

  8. albie0803

    albie0803 Alibre Super User

    Looking at this again I came across

    # create parameter with specific units
    WidthParam = MyPart.AddParameter('Width', ParameterTypes.Distance, ParameterUnits.Centimeters, 7.32)

    should it be ?????

    AttachToExcel('C:\Users\Allan\Test.xlsx', 'Sheet1', 'A1', ParameterTypes.Distance, ParameterUnits.Centimeters)

    just a stab in the dark, I really have no idea :confused:o_O
  9. NateLiqGrav

    NateLiqGrav Alibre Super User

    I tried it like that (and other variations) earlier. It seems like something is just unfinished.
  10. ajayre

    ajayre Alibre Super User

    This is a bug. Albie is correct that the last parameter should be units not parameter type, e.g. UnitTypes.Centimeters. Will be fixed for the next release.

    idslk likes this.
  11. idslk

    idslk Alibre Super User

Share This Page