全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:2815
推到 Plurk!
推到 Facebook!

如何取消excel.exe

答題得分者是:syntax
甘蔗夫
一般會員


發表:76
回覆:19
積分:19
註冊:2004-08-25

發送簡訊給我
#1 引用回覆 回覆 發表時間:2007-12-10 09:27:26 IP:61.14.xxx.xxx 訂閱
各位大大,
我用ole開啟excel檔案,但我有執行關閉離開的動作,但process裡始終都存在excel.exe,是否有辦法解決
syntax
尊榮會員


發表:26
回覆:1139
積分:1258
註冊:2002-04-23

發送簡訊給我
#2 引用回覆 回覆 發表時間:2007-12-10 13:45:41 IP:61.64.xxx.xxx 訂閱
「取消 excel.exe」?取消?
恩在地球應該說「結束 excel 程序」
你中文哪學的?

你有執行關閉,但成功了嗎?

===================引 用 甘蔗夫 文 章===================
各位大大,
我用ole開啟excel檔案,但我有執行關閉離開的動作,但process裡始終都存在excel.exe,是否有辦法解決
甘蔗夫
一般會員


發表:76
回覆:19
積分:19
註冊:2004-08-25

發送簡訊給我
#3 引用回覆 回覆 發表時間:2007-12-10 15:28:59 IP:61.14.xxx.xxx 訂閱
Sorry,
用詞不當,我執行下面去關閉程序,但沒用
ExcelBook.OleFunction("Close",InputEdit->Text.c_str());
ExcelApp.OleFunction("Quit");
syntax
尊榮會員


發表:26
回覆:1139
積分:1258
註冊:2002-04-23

發送簡訊給我
#4 引用回覆 回覆 發表時間:2007-12-11 00:31:29 IP:61.64.xxx.xxx 訂閱
1. 只是建議你修改標題,這樣人才看得懂,不然你會錯過知道解決方式的人
2. 你有執行關閉,但成功了嗎?
3. 方法不只一種,何不試試

ExcelSheet.Application.Quit();

ExcelApp.Quit;

===================引 用 甘蔗夫 文 章===================
Sorry,
用詞不當,我執行下面去關閉程序,但沒用
ExcelBook.OleFunction("Close",InputEdit->Text.c_str());
ExcelApp.OleFunction("Quit");
chardbcb
一般會員


發表:0
回覆:1
積分:0
註冊:2006-10-11

發送簡訊給我
#5 引用回覆 回覆 發表時間:2008-06-10 16:55:26 IP:220.135.xxx.xxx 訂閱
可以參考 Variant::Exec example
如下說明


[code cpp]

#include
// declare global Variant for Automation interface
Variant MSWord;
//Declare AutoCmd objects for methods on Automation interface
PropertySet VisTrue("Visible");
Procedure QuitFalse("Quit");
PropertyGet GetDocs("Documents");
PropertyGet GetSel("Selection");
Function DocAdd("Add");
Procedure AddText("TypeText");
Procedure AddDate("InsertDateTime");
Procedure AddPara("TypeParagraph");

[/code]
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
//Initialize AutoCmd objects with their parameters
VisTrue << true;
QuitFalse << false;
//Set up named parameters for date/time method call
AddDate <<
NamedParm("DateTimeFormat", "dddd, dd MMMM yyyy") <<
NamedParm("InsertAsField", false);
}
void __fastcall TForm1::btnStartWordClick(TObject *Sender)
{
MSWord = Variant::CreateObject("Word.Application");
MSWord.Exec(VisTrue);
}
void __fastcall TForm1::btnStopWordClick(TObject *Sender)
{
//Should be able to just use the 2nd statement
//but MS Office 97 doesn't adhere to the lifetime
//management aspects of the MS COM spec.
MSWord.Exec(QuitFalse);
MSWord = Unassigned;
}
void __fastcall TForm1::btnNewDocClick(TObject *Sender)
{
Variant DocCollection = MSWord.Exec(GetDocs);
DocCollection.Exec(DocAdd);
}
void __fastcall TForm1::btnInsertTextClick(TObject *Sender)
{
Variant Sel = MSWord.Exec(GetSel);
AddText.ClearArgs();
Sel.Exec(AddText << WideString(memTextForWord->Text));
Sel.Exec(AddDate);
Sel.Exec(AddPara);
}

系統時間:2024-04-25 19:46:17
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!