选择文件并运行VBA代码的表单

时间:2015-08-13 02:33:18

标签: vb.net excel vba excel-vba

假设我有两个Excel文件和一个VBA代码文件:

File1.xlsx
File2.xlsx
Macro.vb

使用Visual Basic我正在尝试创建一个Windows窗体程序,它允许我浏览File1,File2和宏文件。

选择文件后,宏需要使用File1和File2中的数据并更新File1。

这是表格的图片,以及它的代码行。

form pic

Public Class frmStuff

Private Sub btnBrowse1_Click(sender As System.Object, e As System.EventArgs) Handles btnBrowse1.Click

End Sub    

Private Sub btnBrowse2_Click(sender As System.Object, e As System.EventArgs) Handles btnBrowse2.Click

End Sub

Private Sub btnBrowse3_Click(sender As System.Object, e As System.EventArgs) Handles btnBrowse3.Click

End Sub

Private Sub txtFile1_Text(sender As System.Object, e As System.EventArgs) Handles txtFile1.Text

End Sub

Private Sub txtFile2_Text(sender As System.Object, e As System.EventArgs) Handles txtFile2.Text

End Sub

Private Sub txtMacro_Text(sender As System.Object, e As System.EventArgs) Handles txtMacro.Text

End Sub

Private Sub btnRun_Click(sender As System.Object, e As System.EventArgs) Handles btnRun.Click

End Sub

Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click

End Sub
End Class

是否需要打开Excel文件才能运行宏?

如果可以,我也可以帮助您打开Excel文件。

1 个答案:

答案 0 :(得分:0)

抱歉,有点冲动。从那时起我就开始研究这个问题了,并且已经开始工作了。

我现在遇到的问题,如果我无法解决,我会发布。 干杯无论如何