Excel里面,用宏程序编写一个可以保存表格并退出当前表格。设置一个按钮

 Excel里面,用宏程序编写一个可以保存表格并退出当前表格。设置一个按钮,第1张

可以的。

Option Explicit

Private Sub CommandButton1_Click()

ActiveWorkbook.Close True

End Sub

[file,path]=uiputfile({'*.xls','Excel'},'open')

if file

xlswrite([path file],str2num(get(handles.edit3,'string')),'sheet1')

xlswrite([path file],str2num(get(handles.edit4,'string')),'sheet2')

xlswrite([path file],str2num(get(handles.edit5,'string')),'sheet3')

xlswrite([path file],str2num(get(handles.edit6,'string')),'sheet4')

xlswrite([path file],str2num(get(handles.edit5,'string')),'sheet5')

msgbox('the result is saved in sheet1\sheet2\sheet3\sheet4\sheet5','save')

else

msgbox('you havenot saved the result','not save')

end


欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/yw/8172555.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-14
下一篇 2023-04-14

发表评论

登录后才能评论

评论列表(0条)

保存