+ Reply to Thread
Results 1 to 2 of 2

where do I find docs on excel automation programming?

  1. #1
    Mike
    Guest

    where do I find docs on excel automation programming?

    From c# I start excel, open a workbook and run a specfic macro. I have code
    to do this but I don't know how to pass a parameter to the macro and I
    cannot find an documentation on it.

    This is my code, I believe one of the missing.values can be a parameter but
    not sure

    oXL.Workbooks.Open(strFileName, 0, false, 5, "", "", false,
    Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
    oXL.Application.Run("ThisWorkbook.ProcessKrunFile",
    Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
    Missing.Value,
    Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
    Missing.Value,
    Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
    Missing.Value,
    Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
    Missing.Value,
    Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
    Missing.Value);

    thanks



  2. #2
    AA2e72E
    Guest

    RE: where do I find docs on excel automation programming?

    Looks like ProcessKrunFile is a macro in ThisWorkbook: how can you/anyone
    write a macro which need 30 arguments?

    Excel macros accept their parameters by position (i.e. you supply every
    parameter in the order listed in the header of the macro) or by name. Eg

    ActiveWorkbook.SaveAs FileName:="c:\xx.xls" Format:=xlNormal

    The advantage in passing parameters by name is that the parameters you do
    not specify inherit a default value in the Excel Object.

    I don't know how you specify := in C# and I believe Excel constants (like
    xlNormal) are likely to be unavailable and you will have to specify the
    value; the later is easy, you can find out from Excel via its help or simply
    type ?xlNormal in the Immediate Window of the VBE. There must be an example
    that illustrates how to code := in C#.

    I'd search for "Excel" "Interrop" in Google; you might be lucky.




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1