excel录制宏运行规划求解不能运行的问题

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/wxy8511/article/details/77601325

        当我们录制宏进行规划求解,事后发现录制的宏无法运行,有时会出现子过程或函数未定义的问题,此时需要参考一下文章:点击打开链接

在工具列表的引用项是灰色的,这往往是因为宏处于运行或中断状态,此时需要在运行列表中点击重新设置,引用选项回复正常。

       当我们编好宏以后,关闭Excel会重新打开会发现之前编的宏找不到了,这是因为我们将Excel保存为.xlsx的形式,宏没有被保存。正确的做法是将Excel另存为.xlsm形式,再重新打开就可以正常使用了。
展开阅读全文

请教C#操作excel运行宏的问题

12-13

机器win server2003安装了Office2003并下载了一个Microsoft.Office.Interop.Excel.dll版本为12.0.4518.1014rn我在创建Excel时遇到了两个问题rn1.workbook的SaveAs(outputFileName, missing, missing, ......)方法在没有设定excel.DisplayAlerts = false时会自动弹出提示框让用户选择是否覆盖吗?rn2. application.Run(macroName, missing, missing, .....)方法,如果宏里面有MsgBox(),那么程序将会卡在此处也不报错就一直停着,并且不显示对话框。我怀疑对话框虽然不显示但它确实存在并且阻挡了程序的继续运行。请问这个是什么原因?rnrn部分代码如下:rnrnMicrosoft.Office.Interop.Excel.Application excel = new ApplicationClass();rnexcel.Visible = false;rnobject missing = Missing.Value;rnrnstring templateFileName = this.TemplateFilename;rnWorkbook myBook = excel.Workbooks.Open(templateFileName, missing, missing, missing, missing, missing,rn missing, missing, missing, missing, missing, missing, missing, missing, missing);rnWorksheet mySheet = (Worksheet)myBook.Sheets.get_Item(1);rnrnobject macroName = this.MacroName;rnobject csvFileName = this.CsvFilename;rnexcel.Run(macroName, missing, missing, missing, missing, missing, missing, missing, missing, missing,rn missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, rn missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);rnrnstring outputFileName = this.OutputFilename;rnexcel.DisplayAlerts = false;rnmyBook.SaveAs(outputFileName, missing, missing, missing, missing, missing, XlSaveAsAccessMode.xlNoChange,rn missing, missing, missing, missing, missing);rnrnmyBook.Close(null, null, null);rnexcel.Workbooks.Close();rnexcel.Quit();rn 论坛

此代码不能运行 求解!!!

04-14

#include rn#includern#includern#define max 100rntypedef struct Labrnrnchar name,kind,people;rnint num;rnstruct Lab *next;rnLab,*Labb;rnrnrnvoid InitLab(Labb &l)rnrn l = new Lab; rnl->next = NULL; rnrnrnrnvoid creatlab(Labb &l,int n)rnrnLabb p,s;rns=l;rnint i,d;rnchar a,b,c;rnfor(i=1;i<=n;i++)rncin>>a;cin>>b;cin>>c;cin>>d;rnp=new Lab;rnp->name=a;rnp->kind=b;rnp->people=c;rnp->num=d;rnp->next = NULL;rnl->next=p;rnl=p;rnrnl=s;rnrnvoid insertlab(Labb &l,int i,char a,char b,char c,int d)rnrn Labb p,q,s;rnint m=0;rnif(i==1)rnrnp=new Lab;rnrnp->name=a;rnp->kind=b;rnp->people=c;rnp->num=d;rnp->next=l->next;rnl->next=p;rnrnrnelserns=l;rnwhile(m!=i-1)rnrns=s->next;rnm++;rnrnq=new Lab;rnp->name=a;rnp->kind=b;rnp->people=c;rnp->num=d;rnq->next=s->next;rns->next=q;rnrnrnvoid xiugai(Labb &l,int i ,char a,char b,char c,int d)rnLabb s;rnint m=0;rns=l;rnwhile(i!=m)rns=s->next;rnrns->name=a;rns->kind=b;rns->people=c;rns->num=d;rnrnvoid chaxun(Labb &l,char a)rnLabb s;rns=l;rnwhile(s->name!=a)rnrns=s->next;rnrnprintf("%s\n",s->name);rnprintf("%s\n",s->kind);rnprintf("%s\n",s->people);rnrnprintf("%s\n",s->num);rnrnrnvoid Printlab(Labb l ) rn rnLabb s=l->next;rn cout<<"The laborary is:"<name<<" ";rncout<kind<<" ";rn rn cout<people<<" ";rncout<num<<" ";rnrnrns=s->next;rn rn rn rn cout<next;rn delete p;rn rn elsern rnp=l;rn while (m!=i-1)rn p=p->next;rn m++;rn rn s=p->next;rn p->next=p->next->next;rn delete s;rn rn rnvoid main()rnrnLabb La;rnint n;rnInitLab(La);rnprintf("请输入实验室原有的器材和不同器材的数");rncin>>n;rn creatlab(La, n);rnprintf("1 2 3 4 6\n");rn printf("添加 删除 修改 查询 显示\n");rn printf("请选择:\n");rn scanf("%d",&n);rn switch(1)rnrncase 1:rnprintf("请输入 插入位置 设备的名字 种类 管理人 数量");rnchar q,w,e;rnint d,i;rncin>>q;cin>>w;cin>>e;cin>>d;cin>>i;rn insertlab(La,i,q,w,e,d);rn break;rncase 2:rnprintf("请输入删除的位置");rnint j;rncin>>j;rn ListDelete_L(La,j);rn break;rncase 3:rnprintf("请输入设备的名字 种类 管理人 数量和插入位置");rnchar z1,z2,z3;rnint d1,i1;rncin>>z1;cin>>z2;cin>>z3;cin>>d1;cin>>i1;rnxiugai(La,i,q,w,e,d);rnbreak;rncase 4:rnprintf("请输入设备的名字");rnchar a;rnchaxun(La,a);rnbreak;rnrncase 6:rnPrintlab(La);rnbreak;rnrnrnrn rn rn rn rn 论坛

没有更多推荐了,返回首页