如何在visual studio 2010中使用宏 [英] How to use macro in visual studio 2010

查看:89
本文介绍了如何在visual studio 2010中使用宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好家伙



任何人都可以给我简单的宏程序我写下面的代码



 使用系统; 
使用 System.Collections.Generic;
使用 System.ComponentModel;
使用 System.Data;
使用 System.Drawing;
使用 System.Linq;
使用 System.Text;
使用 System.Windows.Forms;
使用 Microsoft.Office.Interop.Access.Dao;
命名空间 WindowsFormsApplication2
{ public 部分 Form1:表单
{ public Form1()
{InitializeComponent();}
private void button1_Click( object sender,EventArgs e)
{Microsoft.Office.Interop.Access.Application acApp = new Microsoft.Office.Interop.Access 。应用();
尝试 {acApp.OpenCurrentDatabase( @ C:\ Users \Administrator \Desktop\test.mdb true ); / / 打开mdb文件
对象 oMissing = System.Reflection.Missing.Value ;
acApp.Run( Macro1 ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing , ref oMissing, ref oMissing, ref oMissing, ref oMissing
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing
ref oMissing, ref oMissing);}
catch
{}
最后
{acApp.Quit(); // 退出申请}}}}



但是它给了我一个你找不到的错误宏,你能给我解决方案或代码,我使用访问数据库,或者你能给我一个使用ms访问C#.NET的示例代码

解决方案

< a href =http://support.microsoft.com/kb/306683> http://support.microsoft.com/kb/306683 [ ^ ]



希望它会有所帮助..


请参阅以下链接





http://www.pcreview.co.uk/forums/run-microsoft-access- module-vs-net-c-t1379444.html

http://support.microsoft .com / kb / 306682

http://msdn.microsoft.com/en-us/library/office/aa140195%28v=office.10%29.aspx


请参阅以下链接





http://www.pcreview.co.uk/forums/run-microsoft-access -module-vs-net-c-t1379444.html

http:// support。 microsoft.com/kb/306682

http://msdn.microsoft.com/en-us/library/office/aa140195%28v=office.10%29.aspx


Hello guys

can anyone give me simple program on macro i write a below code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Office.Interop.Access.Dao;
namespace WindowsFormsApplication2
{ public partial class Form1 : Form
    {public Form1()
        {InitializeComponent();}
        private void button1_Click(object sender, EventArgs e)
        {Microsoft.Office.Interop.Access.Application acApp = new Microsoft.Office.Interop.Access.Application();
            try{acApp.OpenCurrentDatabase(@"C:\Users\Administrator\Desktop\test.mdb",true);//open mdb file
                object oMissing = System.Reflection.Missing.Value;
                acApp.Run("Macro1", ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing
                , ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing
                , ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing
                , ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing
                , ref oMissing, ref oMissing);}
            catch
            {}
            finally
            {acApp.Quit();//exit application}}}}


but it gives me an error that you cannot find the macro can you give me solution or code for that i use the access database or can you give me example code for using ms-access for C# .NET

解决方案

http://support.microsoft.com/kb/306683[^]

Hope it will help..


Please see following links



http://www.pcreview.co.uk/forums/run-microsoft-access-module-vs-net-c-t1379444.html
http://support.microsoft.com/kb/306682
http://msdn.microsoft.com/en-us/library/office/aa140195%28v=office.10%29.aspx


Please see following links



http://www.pcreview.co.uk/forums/run-microsoft-access-module-vs-net-c-t1379444.html
http://support.microsoft.com/kb/306682
http://msdn.microsoft.com/en-us/library/office/aa140195%28v=office.10%29.aspx


这篇关于如何在visual studio 2010中使用宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆