string ls_name,ls_pathname
boolean lb_exist
if datawin.RowCount()<1 then
MessageBox("提示信息","請先檢索出數據再導出至Excel!")
return -1 //error
end if
li_rtn=GetFileSaveName("保存文件",ls_pathname,ls_name,"xls","Excel文件(*.xls),*.xls")
if li_rtn=1 then
lb_exist = FileExists(ls_pathname) //看該文件是否存在
IF lb_exist THEN
li_rtn = MessageBox("保存", ls_pathname+"已經存在,是否覆蓋?",Exclamation!, YesNo!)
end if
if li_rtn=1 then
//當文件存在,用戶選擇覆蓋,或是文件本就不存在時. 註意變量li_rtn
li_rtn=datawin.SaveAsAscii(ls_pathname)
if li_rtn=1 then
MessageBox("提示信息","導出數據成功!")
else
MessageBox("錯誤信息","導出數據失敗!")
return -1//error
end if
else
return -1//error
end if
else
return -1
end if