?? form1.frm
字號:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "end"
Height = 435
Left = 2400
TabIndex = 1
Top = 480
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "excel"
Height = 495
Left = 480
TabIndex = 0
Top = 480
Width = 1575
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim xlapp As Excel.Application
Dim xlbook As Excel.Workbook
Dim xlsheet As Excel.Sheets
Private Sub Command1_Click()
If Dir("D:\temp\excel.bz") = "" Then
Set xlapp = CreateObject("excel.application")
xlapp.Visible = True
Set xlbook = xlapp.Workbooks.Open("D:\temp\bb.xls")
Set xlsheet = xlbook.Worksheets(1)
xlsheet.Cells(1, 1) = "abc"
xlbook.RunAutoMacros (xlAutoOpen)
Else
MsgBox ("excel已打開")
End If
End Sub
Private Sub Command2_Click()
If Dir("D:\temp\excel.bz") <> "" Then
xlbook.RunAutoMacros (xlAutoClose)
xlbook.Close (True)
xlapp.Quit
End If
Set xlapp = Nothing '釋放EXCEL對象
End
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -