如何在有2个确省值的过程中只设置第2个参数,第1个保持默ť |
尚未結案
|
ilikeff8
一般會員 發表:12 回覆:16 積分:5 註冊:2002-12-28 發送簡訊給我 |
我在delphi中调用excel vb api函数copy
sheets("sheet1").copy复制工作表 我想复制到最后但是定义说明是: expression.Copy([Before],[After])
Before 语法 3: Variant 类型,可选。复制工作表放到此工作表之前。如果已经指定了 After,则不能指定 Before。
After Variant 类型,可选。复制工作表放到此工作表之后。如果已经指定了 Before,则不能指定 After。 所以我要设置第2个参数after,忽略第一个参数before
|
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
|
ilikeff8
一般會員 發表:12 回覆:16 積分:5 註冊:2002-12-28 發送簡訊給我 |
引言: EmptyParam is what you need. >>< face="Verdana, Arial, Helvetica"> 我很认真的做....... procedure a(x:string='10';y:string='20'); begin showmessage(x y); end; procedure TForm1.Button1Click(Sender: TObject); begin a(EmptyParam,'f'); end; "Invalid variant type conversion." EmptyParam variable Specifies that an optional parameter on a dual interface is not used. Unit System Category COM utilities var EmptyParam: OleVariant; Description When marshaling interface calls that include optional parameters, COM still requires a value for those parameters even when they are not used. Pass EmptyParam as that value to indicate that the parameter is not used. 哎,人生无趣啊 |
timhuang
尊榮會員 發表:78 回覆:1815 積分:1608 註冊:2002-07-15 發送簡訊給我 |
|
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
引言:EmptyParam can only be used as variant. For example ExcelWorkSheet1.Copy(EmptyParam,EmptyParam) but in your case x wants a string and of course EmptyParam cannot be converted into a string.procedure a(x:string='10';y:string='20'); begin showmessage(x y); end; procedure TForm1.Button1Click(Sender: TObject); begin a(EmptyParam,'f'); end; |
ilikeff8
一般會員 發表:12 回覆:16 積分:5 註冊:2002-12-28 發送簡訊給我 |
引言:yes ,you r rignt,i passed the test thanks引言:EmptyParam can only be used as variant. For example ExcelWorkSheet1.Copy(EmptyParam,EmptyParam) but in your case x wants a string and of course EmptyParam cannot be converted into a string.procedure a(x:string='10';y:string='20'); begin showmessage(x y); end; procedure TForm1.Button1Click(Sender: TObject); begin a(EmptyParam,'f'); end; |
ilikeff8
一般會員 發表:12 回覆:16 積分:5 註冊:2002-12-28 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |