On Tue, 28 Feb 2012 16:42:25 -0800 (PST), Nondisclosure007 wrote:
> Ok, this HAS to be my old age catching up to me. But for some reason,
> I can't seem to get this.
>
> How can I do this programatically? I've searched the web and found
> thousands upon thousands of ways to do this via win form, console,
> etc. But I can't find a way to do this via DLL.
It's the same for a DLL as for an EXE (WinForms, console, WPF, whatever).
> I've found some classes @ codeproject and others but can't figure out
> how to adapt them to be more simply what I want.
>
> The main reason why I want to do this is to learn.
>
> Here's my code:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Excel = Microsoft.Office.Interop.Excel;
>
> namespace ExcelMT4
> {
>
> public class UnmanagedExports
> {
> Excel.Application excelApp;
> Excel.Workbook excelWorkBook;
> Excel.Worksheet excelWorkSheet;
> Excel.Range excelRange;
>
> static void OpenExcel(string strFileName)
> {
> excelApp = new Excel.Application;
> }
>
> }
> }
>
> I can't get past opening Excel in the compilier!
What does that even mean? You don't use a compiler to open things. You
use a compiler to compile your C# code.
You should first take the time to formulate a good, useful question. That
means posting a concise-but-complete code example that reliably
demonstrates the problem, as well as describing _exactly_ what the problem
is. Include the exact text of any error messages, as well as a complete
description of anything else that you do and which does not work the way
you expect it to.
In this case, it is probably also useful if you explain exactly how your
DLL project is configured. What settings are used, what references have
you added, etc.?
Pete