''另存为'用户选项 [英] '' save as" option to user

查看:86
本文介绍了''另存为'用户选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序将数组保存为d盘中的excel表格:

代码为:

my application saves an array as as excel sheet in d drive:
the code is:

xlWorkSheet.SaveAs("D:\vbexcel.xlsx")





如何为用户提供另存为选项,以便用户可以保存文件任何位置。?



how can i give a "save as" option to user so that the user can save the file in any location.?

推荐答案

使用SaveFileDialog:



Use the SaveFileDialog:

Private Sub myButton_Click(sender As Object, e As EventArgs)
        Dim myStream As Stream
        Dim saveFileDialog As New SaveFileDialog()

        saveFileDialog.Filter = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*"
        saveFileDialog.FilterIndex = 2
        saveFileDialog.RestoreDirectory = True

        If saveFileDialog.ShowDialog() = DialogResult.OK Then
            xlWorkSheet.SaveAs(saveFileDialog.Filename)
        End If
End Sub





希望这会有所帮助,

Fredrik



Hope this helps,
Fredrik


这篇关于''另存为'用户选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆