不打开EXCEL读取表格中的数据。
比如读取D:\\税金.xls中sheet1中A1:B20的数据
dim i as integer
application.screenupdating=false
for i=1 to 20
activesheet.cells(i,1).formula=\税金.xls]sheet1'!$A$\
activesheet.cells(i,2).formula=\税金.xls]sheet1'!$B$\ next i
activesheet.range(\
activesheet.range(\
Application.CutCopyMode = False
application.screenupdating=true
运行一下后,发现比打开、读取、关闭的操作快多了,特与大家分享。
Private Sub CommandButton1_Click()
Columns(2).Formula = \End Sub
Private Sub CommandButton2_Click() Dim str As String str = \
Columns(5).Formula = \
& \End Sub
Private Sub CommandButton3_Click() Columns(5).Clear End Sub
Private Sub CommandButton1_Click() Dim newapp As Excel.Application
Set newapp = CreateObject(\
newapp.AutomationSecurity = msoAutomationSecurityForceDisable '更改为宏无效 newapp.Visible = False Dim wb As Workbook
Set wb = \系统专用\\我的设置\\桌面\\book2.xls\MsgBox wb.Worksheets(1).Cells(2, 3) newapp.DisplayAlerts = False newapp.Quit End Sub
不打开EXCEL读取表格中的数据
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)