當前位置:編程學習大全網 - 源碼破解 - PB 導數據EXCEL代碼

PB 導數據EXCEL代碼

將下面代碼復制,粘貼到記事本內,另存為f_pbtoexcel.srf,然後倒入都pb程序內,用法:加入數據窗口是dw_1,那麽就f_pbtoexcel(dw_1)。

$PBExportHeader$f_pbtoexcel.srf

$PBExportComments$輸出數據到Excel

global type f_pbtoexcel from function_object

end type

forward prototypes

global function integer f_pbtoexcel (datawindow adw)

end prototypes

global function integer f_pbtoexcel (datawindow adw);integer li_rtn,ii,li_asc

string ls_name,ls_pathname

boolean lb_exist

if adw.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=adw.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

return 1

end function

  • 上一篇:諾基亞發布新機,自稱不只有情懷,諾基亞 X71真的能挽回消費者的心嗎?
  • 下一篇:湖南臺放的電視劇《愛在春天》裏洪蓮西喜歡的那個男的是叫高逸天還是叫劉富帥?是誰演的啊?
  • copyright 2024編程學習大全網