Skip to content

Instantly share code, notes, and snippets.

@1dolinski
Created July 12, 2013 19:19
Show Gist options
  • Save 1dolinski/5987008 to your computer and use it in GitHub Desktop.
Save 1dolinski/5987008 to your computer and use it in GitHub Desktop.
// <---------- [ Program Overview ] ---------->
// Take BND all BND pages from FIS and put them into excel
using System;
// fundamental classes and base classes for value and reference data types, events and event handlers, interfaces, attributes, and processing exceptions
using Microsoft.Office.Interop.Excel;
// using the Excel namespace (added in Microsoft Excel 11.0 Object )
using System.Reflection;
namespace ConsoleApplication3
{
public class ExcelManagemenet
{
public static void NewExcelApp()
{
Application xl = null;
_Workbook wb = null;
// Option 1
xl = new Application();
xl.Visible = true;
wb = (_Workbook)(xl.Workbooks.Add(XlWBATemplate.xlWBATWorksheet));
}
}
public class WindowManagement
{
[DllImport("coredll.dll")]
static extern bool SetForegroundWindow(IntPtr hWnd);
private void BringToFront(Process pTemp)
{
SetForegroundWindow(pTemp.MainWindowHandle);
}
}
public class Program
{
static void Main(string[] args)
{
System.Console.WriteLine("Put FIS to the Main Menu");
System.Console.Read();
// need to reference this excel sheet
ExcelManagemenet.NewExcelApp();
}
}
}
@1dolinski
Copy link
Author

Error 1 The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly reference?) E:\project\csharp\ConsoleApplication3\ConsoleApplication3\Program.cs 33 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment