来源:https://bbs.csdn.net/topics/340141130
作者:十豆三
* VFP8.0 Or VFP9.0
m.llExit=.T.
Try
m.Excel=Createobject("Excel.Application")
m.Excel=Null
Catch
m.llExit=.F.
Endtry
If m.llExit=.F.
Messagebox("没有安装 Excel!",48,"信息提示")
Return
Endif
LOCAL lOldSetOpt,mChanNum
lOldSetOpt = DDESetOption("SAFETY")
= DDESetOption("SAFETY",.F.)
mChanNum = DDEInitiate('Excel', 'SYSTEM') &&EXCEL是否已经打开
IF mChanNum # -1
= MESSAGEBOX('程序 EXCEL 已经打开,请先将其关闭!', 64, '系统提示!')
= DDETerminate(mChanNum)
= DDESetOption("SAFETY",lOldSe...