열린 Excel 제어

2931 단어 Excel
using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using Excel = Microsoft.Office.Interop.Excel; 



namespace ExcelTest

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }



        private void button1_Click(object sender, EventArgs e)

        {

            object misValue = System.Reflection.Missing.Value;

            Excel.Application xlApp;

            xlApp = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");

            //xlApp.ActiveSheet.Pictures.Paste();



            Excel.Workbooks m_objBooks = (Excel.Workbooks)xlApp.Workbooks;



            foreach (object o in m_objBooks)

            {

                string s = ((Excel.Workbook)o).Name;

                MessageBox.Show(s);

                ((Excel.Workbook)o).ActiveSheet.Pictures.Paste().Select();

            }

        }



    }

}

좋은 웹페이지 즐겨찾기