1. | 在 Visual Basic 中创建一个标准 EXE 项目。默认情况下会创建 Form1。 |
2. | 单击“项目”菜单中的“引用”,然后选中“Microsoft Visual Basic for Applications Extensibility”。 |
3. | 向 Form1 中添加一个 CommandButton。 |
' Start Excel
Dim xlapp As Object 'Excel.Application
Set xlapp = CreateObject("Excel.Application")
' Make it visible...
xlapp.Visible = True
' Add a new workbook
Dim xlbook As Object 'Excel.Workbook
Set xlbook = xlapp.Workbooks.Add
' Add a module
Dim xlmodu