|
模块1
- Public xls As XlsApp
- Sub Exx()
- Set xls = New XlsApp
- With xls.xlApp
- .Workbooks.Add
- .Visible = True
- End With
- 'Debug.Print "excel open"
- End Sub
- Sub AppExit()
- Form_窗体1.Visible = False
- Set xls = Nothing
- 'Debug.Print "excel close"
- Application.CloseCurrentDatabase
- End Sub
复制代码
Form1
- Private Sub Command0_Click()
- Exx
- End Sub
-
- Private Sub Form_Load()
- Exx
- End Sub
-
复制代码
类模块
- Public WithEvents xlApp As Excel.Application
- Private Sub Class_Initialize()
- Set xlApp = New Excel.Application
- End Sub
- Private Sub xlApp_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Excel.Range, Cancel As Boolean)
- Target = "msg from Acc!"
- Cancel = True
- End Sub
- Private Sub xlApp_WorkbookBeforeClose(ByVal Wb As Excel.Workbook, Cancel As Boolean)
- AppExit
- End Sub
复制代码
Acc2003Vba_mde.rar
(30.65 KB, 下载次数: 311)
用 access2003 做了个MDE,打开会自动新建 Excel 。
双击 excel 的单元格,会显示一条消息。
rar 里有2个文件, mde 是代码保护的, mdb 是原文件。
|
|