好文档 - 专业文书写作范文服务资料分享网站

不打开EXCEL读取表格中的数据

天下 分享 时间: 加入收藏 我要投稿 点赞

不打开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读取表格中的数据

不打开EXCEL读取表格中的数据。比如读取D:\\税金.xls中sheet1中A1:B20的数据dimiasintegerapplication.screenupdating=falsefori=1to20activesheet.cells(i,1).formula=\税金.x
推荐度:
点击下载文档文档为doc格式
6ai865hypl6trx01723y3gzju6vsnw00dhs
领取福利

微信扫码领取福利

微信扫码分享