50分!!!如何用vb控制excel文件的保存???

lll2002 2002-06-15 11:46:35
利用vb可以实现打开,建立,修改excel文件。
但是在保存的时候,对于excel中对话框的按钮值能不能实现控制。
比如关闭workbook的时候,excel会问保存还是不保存。
现在想用vb控制:
如果用户选择保存按钮,动作1;
如果用户选择不保存按钮,动作2;
如果用户选择取消按钮,动作3;
在vb中,msgbox的按钮值是可以得到的,那么怎么控制excel中的按钮值呢?


非常紧急!
请指教。
...全文
120 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhpfaff 2002-06-16
  • 打赏
  • 举报
回复
你使用CommonDialog 控件的“另存为”对话框
先把excel文件保存为一个临时文件,然后用ShowSave来让用户选择,如果保存就filecopy
liad 2002-06-15
  • 打赏
  • 举报
回复
@
http://search.microsoft.com/gomsuri.asp?n=4&c=rp_Results&siteid=us/dev&target=http://msdn.microsoft.com/library/en-us/modcore/html/deovrCreatingSavingOpeningClosingWorkbookObjects.asp

You can save a new workbook by using the Workbook object's SaveAs method and specifying the name of the workbook you want to save. If a workbook by that name already exists, an error occurs. When a workbook has been saved by using the SaveAs method, additional changes are saved by using the Workbook object's Save method. You can also save a copy of an existing workbook with a different file name by using the SaveCopyAs method. You can supply a file name to be used with the SaveAs or SaveCopyAs method, or you can use the Application object's GetSaveAsFileName method to let the user supply the name to be used to save the workbook. If the user clicks Cancel in the Save As dialog box, the GetSaveAsFileName method returns False.
lll2002 2002-06-15
  • 打赏
  • 举报
回复
GetSaveAsFileName 怎么使用?
给点代码看看吧,谢谢!
lll2002 2002-06-15
  • 打赏
  • 举报
回复
GetSaveAsFileName 怎么用?
给点代码看看。
谢谢
alalei 2002-06-15
  • 打赏
  • 举报
回复
哇,原版呀!

7,759

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧