How do you pass an array of VBA values into unmanged code from C# RRS feed

  • Question

  • I have a working version of code that palces an Excel Spreadsheet on a document then prints it to PDF.  I'm using Adobe InDesign for constructing the PDF from spreadsheets.  I am succesful in calling the Adobe Indesign code below in VBScript to resize, then expand my spreadsheet on the page.  The code in VBA looks like this:

     mypage.PageItems.FirstItem().Reframe 2021222766 , Array(Array(1, 1), Array(780, 600))

    I'm trying to convert this code to work in C#, but I can't figure out how to construct the array of VARIANT values for interop.  I've tried constructing an Array of values using the Array class (e.g. Array scale = Array.CreateInstance(typeof(Double), 2),... but that didn't work).

    I get one of two exceptions when I passs try using the Reframe method.  One states that the array doesn't have the right data type, the other is a null reference exception.

    The frustrating thing is that this works from VBA, but I can't figure out the equivalent in C#.


    Sincerely, Donald Roy Airey

    Wednesday, July 20, 2011 1:40 PM


All replies