好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > 用vbs讀取Excel文件的函數代碼

用vbs讀取Excel文件的函數代碼

熱門標簽:辦理膠州400電話財稅 外呼營銷下單系統 加盟電銷機器人好的品牌 海外美發店地圖標注 百度地圖標注怎么卸載 打電話的外呼系統貴不貴 陜西高頻外呼回撥系統哪家好 前鋒辦理400電話申請 新密防封卡外呼系統違法嗎
核心代碼
復制代碼 代碼如下:

Function ReadExcel( myXlsFile, mySheet, my1stCell, myLastCell, blnHeader )
' Function : ReadExcel
' Version : 2.00
' This function reads data from an Excel sheet without using MS-Office
'
' Arguments:
' myXlsFile [string] The path and file name of the Excel file
' mySheet [string] The name of the worksheet used (e.g. "Sheet1")
' my1stCell [string] The index of the first cell to be read (e.g. "A1")
' myLastCell [string] The index of the last cell to be read (e.g. "D100")
' blnHeader [boolean] True if the first row in the sheet is a header
'
' Returns:
' The values read from the Excel sheet are returned in a two-dimensional
' array; the first dimension holds the columns, the second dimension holds
' the rows read from the Excel sheet.
'
' Written by Rob van der Woude
' http://www.robvanderwoude.com
Dim arrData( ), i, j
Dim objExcel, objRS
Dim strHeader, strRange

Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3

' Define header parameter string for Excel object
If blnHeader Then
strHeader = "HDR=YES;"
Else
strHeader = "HDR=NO;"
End If

' Open the object for the Excel file
Set objExcel = CreateObject( "ADODB.Connection" )
' IMEX=1 includes cell content of any format; tip by Thomas Willig
objExcel.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
myXlsFile ";Extended Properties=""Excel 8.0;IMEX=1;" _
strHeader """"

' Open a recordset object for the sheet and range
Set objRS = CreateObject( "ADODB.Recordset" )
strRange = mySheet "$" my1stCell ":" myLastCell
objRS.Open "Select * from [" strRange "]", objExcel, adOpenStatic

' Read the data from the Excel sheet
i = 0
Do Until objRS.EOF
' Stop reading when an empty row is encountered in the Excel sheet
If IsNull( objRS.Fields(0).Value ) Or Trim( objRS.Fields(0).Value ) = "" Then Exit Do
' Add a new row to the output array
ReDim Preserve arrData( objRS.Fields.Count - 1, i )
' Copy the Excel sheet's row values to the array "row"
' IsNull test credits: Adriaan Westra
For j = 0 To objRS.Fields.Count - 1
If IsNull( objRS.Fields(j).Value ) Then
arrData( j, i ) = ""
Else
arrData( j, i ) = Trim( objRS.Fields(j).Value )
End If
Next
' Move to the next row
objRS.MoveNext
' Increment the array "row" number
i = i + 1
Loop

' Close the file and release the objects
objRS.Close
objExcel.Close
Set objRS = Nothing
Set objExcel = Nothing

' Return the results
ReadExcel = arrData
End Function

使用方法:
復制代碼 代碼如下:

Option Explicit

Dim arrSheet, intCount

' Read and display columns A,B, rows 2..6 of "ReadExcelTest.xls"
arrSheet = ReadExcel( "ReadExcelTest.xls", "Sheet1", "A1", "B6", True )
For intCount = 0 To UBound( arrSheet, 2 )
WScript.Echo arrSheet( 0, intCount ) vbTab arrSheet( 1, intCount )
Next

WScript.Echo "==============="

' An alternative way to get the same results
arrSheet = ReadExcel( "ReadExcelTest.xls", "Sheet1", "A2", "B6", False )
For intCount = 0 To UBound( arrSheet, 2 )
WScript.Echo arrSheet( 0, intCount ) vbTab arrSheet( 1, intCount )
Next
您可能感興趣的文章:
  • C#數據導入/導出Excel文件及winForm導出Execl總結
  • php讀取EXCEL文件 php excelreader讀取excel文件
  • Asp.net生成Excel文件并下載(更新:解決使用迅雷下載頁面而不是文件的問題)
  • PHPExcel讀取Excel文件的實現代碼
  • 將datagrid控件內容輸出到excel文件
  • .NET中讀取Excel文件的數據及excelReader應用

標簽:伊春 梅州 阜陽 咸陽 河南 四平 牡丹江 武威

巨人網絡通訊聲明:本文標題《用vbs讀取Excel文件的函數代碼》,本文關鍵詞  用,vbs,讀取,Excel,文件,的,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《用vbs讀取Excel文件的函數代碼》相關的同類信息!
  • 本頁收集關于用vbs讀取Excel文件的函數代碼的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 99久久国产精品户外勾搭| 狠狠插视频| 汤芳性做爰A片免费看| 泰剧《我也很想要》| 大尺度哺乳福利视频| 脱裙打光屁股打红动态图| 欧美黄网址| 古典武侠中文字幕| Chinese亲女伦| 极品少妇XXⅩOOO成人网站| 三上悠亚出差被男上司要了| 我们的日子| TS张思妮 情趣 内衣 自慰| 国产精品亚洲一区在线播放| 好男人社区www影院在线观看| 絕讚海外貴婦人妻婊水川蓳| 公开调教| 大牛影视传媒有限公司| 无人区1080在线完整免费版| 菠萝蜜成人影视| 美女被?到爽??高潮草莓动漫| re99热久久这里只有精品| 操妹子小说| 动漫美女被挤奶吸乳羞羞| 精品国产乱码久久久久久1区2区-亚洲 | 亚洲国产成人精品女人| 久久99热成人精品国产| 亚洲欧美中文日韩综合| 色噜噜狠狠色综无码久久合欧美| 成人无码亚洲精品午夜精品| 学长不要弄了还写作业呢动| 男女打扑克视频| 91免费精品视频| 巜她在丈夫面前被耍了无删减版| 97精品少妇偷拍AV18禁止看| 色香欲综合成人免费视频| 边啃奶头边躁狠狠躁视频免费观看| 国产精品天干天干在线播放| 久久精品视频99精品视频150| 是不是想要了这就给你| 双性国师沦为大臣玩物|