integer li_rtn,ii,li_asc
string ls_name,ls_pathname
boolean lb_exist
if dw_1.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=dw_1.SaveAsAscii(ls_pathname)
if li_rtn=1 then
MessageBox("提示信息","导出数据成功!")
return 1
else
MessageBox("错误信息","导出数据失败!")
return -1//error
end if
else
return -1//error
end if
else
return -1
end if