2018年7月1日 星期日

BCB OLE操作EXCEL(3)

在用 OLE 操作 Excel 時
有可能會遇到剪貼簿裡的資料過大
導致關閉 Excel 時跳出視窗警告
"是否放棄剪貼簿裡的資料"

要避開的話通常會用關閉 DisplayAlert 的方法來避免
但我常常失敗,原因不明。

所以給失敗的朋友另一個辦法
在 Excel 關閉前複製一格 避免剪貼簿裡資料過多跳出視窗


void __fastcall Excel::Close_2(){
    Exc.Range = Exc.WorkSheet.OlePropertyGet("Cells", 1, 1);
    Exc.Range.OleFunction("Copy");
    Exc.WorkBook.OleFunction("Close", false);
    Exc.App.Exec(Procedure("Quit"));
}

上一篇:
BCB OLE操作EXCEL (2)

Related Posts:

  • Linux - Shell Scripts (2)sh vs bash     我有時候用 sh 會讓 shell script 執行不過,通常會報 Bad substitution 之類的錯誤。其實是因為我用 ubuntu,ubuntu 的 sh 其實是指到 dash 而非 bash。dash 在這不作多介紹, 把它想像成輕量型的 bash,所以支援的功能有限,所以有機會報錯。 ubuntu: cd /bin/ ubuntu: /bin$ ls -l lrwxrwxrwx … Read More
  • Linux - Shell Scripts (1)sh v.s source     如果直接用 sh 執行 script,基本上就是開一個子程序去執行 script。所以父程序要獲得子程序的結果,通常都是靠著 export 解決 scope 的不同。若是使用 source 去執行 script,則是直接用本身程序去執行,所以本身與腳本享有共同 scope。更多請參考 : 鳥哥私房菜。 基本的 variable & operator    … Read More
  • Linux - Shell Scripts (3) (pipe : grep)管線命令 ( Pipe )     管線命令是用 "|" 去連接,只要前一資料能變成 standard input。管線命令僅會處理 standard output,而不會處理 standard error output。下面用時下最夯的 MBTI 作的假資料。 index name MBTI 1 JunYe ISTJ 2 JunYe ISTP 3 JunYe … Read More
  • Cpp - std::endl vs \n"std::endl" vs "\n"     基本上兩者在換行的效果沒有不同,唯一的不同是 std::endl 會 flush output buffer。若你不想頻繁地 flush output 用 "\n",若你想看所有 output ( 程式不穩定 ) 則用 std::endl 。 參考資料 : https://stackoverflow.com/questions/213907… Read More
  • Makefile 筆記 (2)Makefile 範本 (OS: Linux)     這個 Makefile 有結合 .c 跟 .cpp 檔案, 並且使用一些字串處理 function。 # gcc compiler 參數 CC := gcc CFLAGS := -g -Wall -Werror -std=c99 # g++ compiler 參數 CXX := g++ CXXFLAG :… Read More

0 意見:

張貼留言

Popular Posts