假定book1.xls中有宏为: 宏1()
则它的路径为:
ActiveWorkbook.Application.run('book1.xls!宏1');
则它的路径为:
ActiveWorkbook.Application.run('book1.xls!宏1');
解决方案 »
- dbgrid显示的问题
- image背景透明的问题(Transparent设为true,然后点Picture装载一bmp图像,bmp图像背景色自动去掉,但在程序中用LoadFromFile装载bmp,bmp的背
- 关于在NS-2.28中运行无线网络模拟
- 如何判断edit控件中输入的必须是中文?
- delphi为什么会有这么可笑的缺陷???而且论坛至今没有好的办法 ?
- java和delphi程序员,谁的薪水普遍高?难道java真的比好?
- ~~跪求~~大家帮忙编个程序,小弟做公司网管,主要负责酒店,不懂软件,小弟在北京
- Delphi 5无法单步调试了.需要设置什么地方?
- DELPHI是不是将要被淘汰了,书店的书越来越少,它编写的CGI程序在大多数网站不被支持,完了,我该学什么?
- 这关系到delphi程序员的命运与前途。请快进入!!!!!!
- 一个excel问题:
- 颜色问题??(特急);
供你参考#include <vcl.h>
#pragma hdrstop#include "Unit1.h"
#include <utilcls.h> // util classes实用类说明
#define PG OlePropertyGet
#define PS OlePropertySet
#define FN OleFunction
#define PR OleProcedure
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------void __fastcall TForm1::Button1Click(TObject *Sender)
{
Variant Ex,Wb;
try
{
Ex=Variant::CreateObject("Excel.Application");
}
catch(...)
{
}
if (VarIsEmpty(Ex))
{
ShowMessage("系统没有 Ms Excel !");
return;
}
Ex.PS("Visible",false); // Excel 是否可见
Ex.PS("DisplayAlerts",false); // 是否要出现警告
Wb=Ex.PG("WorkBooks").FN("Open","c:\\test宏\\book1.xls");
Wb.PG("Application").PR("run","book1.xls!宏1");
Ex.PR("Quit"); // 退出Ms Excel
}
//---------------------------------------------------------------------------
'
' 宏1 宏表
' hp记录的宏2001-4-10
'
MsgBox "执行宏了", vbOKOnly, "标题"
End Sub