- 按键认证大神
- 8648672
- 35
- 11
- 573 朵
- 299 个
- 159 个
- 0
- 2022-03-06
|
1#
t
T
发表于 2022-07-04 17:50
|
|只看楼主
读取 Excel 文件的内容并不复杂,很多插件都可以实现,例如懒人插件。 当然我写攻略,这些功能肯定优先选用自己的库实现,这里采用 xBot 组件完成这个功能,大家看我的教程,不要看我具体的功能是怎么实现的,这都是细枝末节,没什么大用,主要是整体的思路是怎么运转的,这个学会了,用处是很大的。 上一章节我们规划好了这个工程的功能拆分和数据结构,接下来我们就实现 Excel 数据读取部分吧,眼尖的小伙伴应该看到了,我把 Excel 操作分成了两个模块,一部分是数据读写,一部分是自动化模块,这也体现了做架构的重要思想,将可重用和不可重用的模块拆分开,可重用的模块积累起来,下个工程还能接着用,如果标准化做得好,甚至可以单独作为一个方案卖出去。 Excel 就是这样的功能,读取我们特定样式的 Excel 文件肯定是专有的功能,但读取一个 Excel 文件,返回这个文件的数据,则是通用功能了,我们在开发的时候,这两类功能一定要严格的区分开,通用的功能是要进解决方案代码库的。 首先我们先实现通用的功能,读取一个 Excel 文件的内容。 Excel 操作一般我们都是用微软提供的 COM 组件进行的,微软的解决方案都非常完善,基本不需要我们再操什么心了,就是对象搞的有点复杂,这里简单讲一下,Excel 为三层对象模型,分别是:应用、工作簿、工作表。 应用,就是我们运行 Excel 程序,打开的这个软件,用 Excel 2003 的小伙伴可能没什么感觉,但如果你用过 WPS 或者比较新的版本会发现,一个软件里,是可以打开很多个工作簿的对吧,所以我们启动一个 Excel 应用,不代表这个应用等于 Excel 工作簿,应用是应用,工作簿是工作簿,工作簿被包含在应用里,这是很重要的概念。 然后一个工作簿又有很多个工作表,这也是包含概念,所以是三层对象模型,当然了,要更深究的话,工作表里面还包含行、列、单元格、选区等概念,这又都是数据的展现形态了,我们只需要了解最小的数据形态:单元格,对接下来的操作就不会存在太多的疑问了。 设计通用函数的数据模型: 我们第一个通用函数的目标是从 Excel 文件里读取数据,怎么才能得到数据呢?我们得知道 Excel 文件的路径吧?我们得知道工作表的名字吧?或者,我们不知道工作表的名字,那得知道工作表是第几个吧?或者是不是被激活的那个?这些是基本信息。 然后,工作经验告诉我,很多人在用 Excel 的时候容易不小心按下按键,导致在例如 60000行写了一个空格,但是这个表没有那么多行,如果我们传递一个表进来,就把这个表的所有数据都读出来,很有可能被这个东西给坑一把,因此有必要我们自己去识别数据的有效范围,或者由程序传递数据的有效范围。 输入的数据和输出的数据我们都确定下来了,接下来开始写代码。 用 xBot 操作 Excel 文件,首先需要将 xBot.dll 添加到按键精灵工程的附件目录内,然后添加 Excel 自动化相关的定义: - Declare Function Excel_Create lib "xBot.dll" Alias "Excel_Create" () As Long
- Declare Function Excel_GetObject lib "xBot.dll" Alias "Excel_GetObject" () As Long
- Declare Function Excel_Visible lib "xBot.dll" Alias "Excel_Visible" (ByVal objExcel As Long, ByVal bShow As Long) As Long
- Declare Function Excel_DisplayAlerts lib "xBot.dll" Alias "Excel_DisplayAlerts" (ByVal objExcel As Long, ByVal bAlert As Long) As Long
- Declare Function Excel_SetCaption lib "xBot.dll" Alias "Excel_SetCaptionA" (ByVal objExcel As Long, ByVal sTitle As String) As Long
- Declare Function Excel_Quit lib "xBot.dll" Alias "Excel_Quit" (ByVal objExcel As Long) As Long
- Declare Function Excel_Books lib "xBot.dll" Alias "Excel_Books" (ByVal objExcel As Long) As Long
- Declare Function Excel_NewBook lib "xBot.dll" Alias "Excel_NewBook" (ByVal objExcel As Long) As Long
- Declare Function Excel_OpenBook lib "xBot.dll" Alias "Excel_OpenBookA" (ByVal objExcel As Long, ByVal sPath As String, ByVal bReadOnly As Long) As Long
- Declare Function Excel_OpenBookEx lib "xBot.dll" Alias "Excel_OpenBookExA" (ByVal objExcel As Long, ByVal sPath As String, ByVal bReadOnly As Long, ByVal sSep As String, ByVal sPwd As String, ByVal sWritePwd As String) As Long
- Declare Function Excel_GetBook lib "xBot.dll" Alias "Excel_GetBookA" (ByVal objExcel As Long, ByVal sPath As String) As Long
- Declare Function Excel_GetBook_Index lib "xBot.dll" Alias "Excel_GetBook_Index" (ByVal objExcel As Long, ByVal iIndex As Long) As Long
- Declare Function Excel_ActiveBook lib "xBot.dll" Alias "Excel_ActiveBook" (ByVal objExcel As Long) As Long
- Declare Function Excel_GetBookCount lib "xBot.dll" Alias "Excel_GetBookCount" (ByVal objExcel As Long) As Long
- Declare Function Excel_CloseAllBook lib "xBot.dll" Alias "Excel_CloseAllBook" (ByVal objExcel As Long) As Long
- Declare Function Excel_Book_Close lib "xBot.dll" Alias "Excel_Book_Close" (ByVal objBook As Long, ByVal bSave As Long) As Long
- Declare Function Excel_Book_Save lib "xBot.dll" Alias "Excel_Book_Save" (ByVal objBook As Long) As Long
- Declare Function Excel_Book_SaveAs lib "xBot.dll" Alias "Excel_Book_SaveAsA" (ByVal objBook As Long, ByVal sPath As String, ByVal iFormat As Long) As Long
- Declare Function Excel_Book_Saved lib "xBot.dll" Alias "Excel_Book_Saved" (ByVal objBook As Long, ByVal bSaved As Long) As Long
- Declare Function Excel_Book_FileFormat lib "xBot.dll" Alias "Excel_Book_FileFormat" (ByVal objBook As Long) As Long
- Declare Function Excel_Book_FullName lib "xBot.dll" Alias "Excel_Book_FullNameA" (ByVal objBook As Long) As String
- Declare Function Excel_Book_Name lib "xBot.dll" Alias "Excel_Book_NameA" (ByVal objBook As Long) As String
- Declare Function Excel_Book_Path lib "xBot.dll" Alias "Excel_Book_PathA" (ByVal objBook As Long) As String
- Declare Function Excel_Book_Activate lib "xBot.dll" Alias "Excel_Book_ActivateA" (ByVal objBook As Long, ByVal sName As String) As Long
- Declare Function Excel_Book_Activate_Index lib "xBot.dll" Alias "Excel_Book_Activate_Index" (ByVal objBook As Long, ByVal iIndex As Long) As Long
- Declare Function Excel_Book_ActiveSheet lib "xBot.dll" Alias "Excel_Book_ActiveSheet" (ByVal objBook As Long) As Long
- Declare Function Excel_Book_Sheets lib "xBot.dll" Alias "Excel_Book_Sheets" (ByVal objBook As Long) As Long
- Declare Function Excel_Book_AddSheet lib "xBot.dll" Alias "Excel_Book_AddSheet" (ByVal objBook As Long, ByVal iPos As Long) As Long
- Declare Function Excel_Book_CopySheet lib "xBot.dll" Alias "Excel_Book_CopySheetA" (ByVal objBook As Long, ByVal sName As String, ByVal iPos As Long) As Long
- Declare Function Excel_Book_CopySheet_Index lib "xBot.dll" Alias "Excel_Book_CopySheet_Index" (ByVal objBook As Long, ByVal iIndex As Long, ByVal iPos As Long) As Long
- Declare Function Excel_Book_GetSheet lib "xBot.dll" Alias "Excel_Book_GetSheetA" (ByVal objBook As Long, ByVal sName As String) As Long
- Declare Function Excel_Book_GetSheet_Index lib "xBot.dll" Alias "Excel_Book_GetSheet_Index" (ByVal objBook As Long, ByVal iIndex As Long) As Long
- Declare Function Excel_Book_GetSheetCount lib "xBot.dll" Alias "Excel_Book_GetSheetCount" (ByVal objBook As Long) As Long
- Declare Function Excel_Book_GetSheetName lib "xBot.dll" Alias "Excel_Book_GetSheetNameA" (ByVal objBook As Long, ByVal iIndex As Long) As String
- Declare Function Excel_Book_SetSheetName lib "xBot.dll" Alias "Excel_Book_SetSheetNameA" (ByVal objBook As Long, ByVal sOldName As String, ByVal sNewName As String) As Long
- Declare Function Excel_Book_SetSheetName_Index lib "xBot.dll" Alias "Excel_Book_SetSheetName_IndexA" (ByVal objBook As Long, ByVal iIndex As Long, ByVal sName As String) As Long
- Declare Function Excel_Book_MoveSheet lib "xBot.dll" Alias "Excel_Book_MoveSheetA" (ByVal objBook As Long, ByVal sName As String, ByVal iPos As Long) As Long
- Declare Function Excel_Book_MoveSheet_Index lib "xBot.dll" Alias "Excel_Book_MoveSheet_Index" (ByVal objBook As Long, ByVal iIndex As Long, ByVal iPos As Long) As Long
- Declare Function Excel_Book_DeleteSheet lib "xBot.dll" Alias "Excel_Book_DeleteSheetA" (ByVal objBook As Long, ByVal sName As String) As Long
- Declare Function Excel_Book_DeleteSheet_Index lib "xBot.dll" Alias "Excel_Book_DeleteSheet_Index" (ByVal objBook As Long, ByVal iIndex As Long) As Long
- Declare Function Excel_Sheet_RowCount lib "xBot.dll" Alias "Excel_Sheet_RowCount" (ByVal objSheet As Long) As Long
- Declare Function Excel_Sheet_ColCount lib "xBot.dll" Alias "Excel_Sheet_ColCount" (ByVal objSheet As Long) As Long
- Declare Function Excel_Sheet_InsertRow lib "xBot.dll" Alias "Excel_Sheet_InsertRow" (ByVal objSheet As Long, ByVal iPos As Long) As Long
- Declare Function Excel_Sheet_InsertCol lib "xBot.dll" Alias "Excel_Sheet_InsertCol" (ByVal objSheet As Long, ByVal iPos As Long) As Long
- Declare Function Excel_Sheet_DeleteRow lib "xBot.dll" Alias "Excel_Sheet_DeleteRow" (ByVal objSheet As Long, ByVal iPos As Long) As Long
- Declare Function Excel_Sheet_DeleteCol lib "xBot.dll" Alias "Excel_Sheet_DeleteCol" (ByVal objSheet As Long, ByVal iPos As Long) As Long
- Declare Function Excel_Sheet_UsedRange lib "xBot.dll" Alias "Excel_Sheet_UsedRange" (ByVal objSheet As Long) As Long
- Declare Function Excel_Sheet_GetRange lib "xBot.dll" Alias "Excel_Sheet_GetRange" (ByVal objSheet As Long, ByVal iRowS As Long, ByVal iColS As Long, ByVal iRowE As Long, ByVal iColE As Long) As Long
- Declare Function Excel_Sheet_GetRangeS lib "xBot.dll" Alias "Excel_Sheet_GetRangeSA" (ByVal objSheet As Long, ByVal sRange As String)) As Long
- Declare Function Excel_Sheet_GetRow lib "xBot.dll" Alias "Excel_Sheet_GetRow" (ByVal objSheet As Long, ByVal iRow As Long) As Long
- Declare Function Excel_Sheet_GetCol lib "xBot.dll" Alias "Excel_Sheet_GetCol" (ByVal objSheet As Long, ByVal iRow As Long) As Long
- Declare Function Excel_Sheet_GetCell lib "xBot.dll" Alias "Excel_Sheet_GetCell" (ByVal objSheet As Long, ByVal iRow As Long, ByVal iCol As Long) As Long
- Declare Function Excel_Sheet_SetRowHeight lib "xBot.dll" Alias "Excel_Sheet_SetRowHeight" (ByVal objSheet As Long, ByVal iRow As Long, ByVal dHeight As Double) As Long
- Declare Function Excel_Sheet_SetColWidth lib "xBot.dll" Alias "Excel_Sheet_SetColWidth" (ByVal objSheet As Long, ByVal iCol As Long, ByVal dWidth As Double) As Long
- Declare Function Excel_Sheet_GetCellText lib "xBot.dll" Alias "Excel_Sheet_GetCellTextA" (ByVal objSheet As Long, ByVal iRow As Long, ByVal iCol As Long) As String
- Declare Function Excel_Sheet_SetCellText lib "xBot.dll" Alias "Excel_Sheet_SetCellTextA" (ByVal objSheet As Long, ByVal iRow As Long, ByVal iCol As Long, ByVal sText As String) As Long
- Declare Function Excel_Sheet_SetRangeText lib "xBot.dll" Alias "Excel_Sheet_SetRangeTextA" (ByVal objSheet As Long, ByVal sRange As String, ByVal sText As String) As Long
- Declare Function Excel_Sheet_GetCellNumber lib "xBot.dll" Alias "Excel_Sheet_GetCellNumber" (ByVal objSheet As Long, ByVal iRow As Long, ByVal iCol As Long) As Double
- Declare Function Excel_Sheet_SetCellNumber lib "xBot.dll" Alias "Excel_Sheet_SetCellNumber" (ByVal objSheet As Long, ByVal iRow As Long, ByVal iCol As Long, ByVal dData As Double) As Long
- Declare Function Excel_Sheet_GetCellInt lib "xBot.dll" Alias "Excel_Sheet_GetCellInt" (ByVal objSheet As Long, ByVal iRow As Long, ByVal iCol As Long) As Double
- Declare Function Excel_Sheet_SetCellInt lib "xBot.dll" Alias "Excel_Sheet_SetCellInt" (ByVal objSheet As Long, ByVal iRow As Long, ByVal iCol As Long, ByVal iData As Long) As Long
- Declare Function Excel_Sheet_SetRangeNumber lib "xBot.dll" Alias "Excel_Sheet_SetRangeNumberA" (ByVal objSheet As Long, ByVal sRange As String, ByVal dData As Double) As Long
- Declare Function Excel_Sheet_SetRangeInt lib "xBot.dll" Alias "Excel_Sheet_SetRangeIntA" (ByVal objSheet As Long, ByVal sRange As String, ByVal iData As Long) As Long
- Declare Function Excel_Sheet_GetCellFormula lib "xBot.dll" Alias "Excel_Sheet_GetCellFormulaA" (ByVal objSheet As Long, ByVal iRow As Long, ByVal iCol As Long) As String
- Declare Function Excel_Sheet_SetCellFormula lib "xBot.dll" Alias "Excel_Sheet_SetCellFormulaA" (ByVal objSheet As Long, ByVal iRow As Long, ByVal iCol As Long, ByVal sFormula As String) As Long
- Declare Function Excel_Sheet_SetCellFormat lib "xBot.dll" Alias "Excel_Sheet_SetCellFormatA" (ByVal objSheet As Long, ByVal iRow As Long, ByVal iCol As Long, ByVal sFormat As String) As Long
- Declare Function Excel_Sheet_CopyRange lib "xBot.dll" Alias "Excel_Sheet_CopyRange" (ByVal objSheet As Long, ByVal iRowS As Long, ByVal iColS As Long, ByVal iRowE As Long, ByVal iColE As Long) As Long
- Declare Function Excel_Sheet_CopyRangeS lib "xBot.dll" Alias "Excel_Sheet_CopyRangeSA" (ByVal objSheet As Long, ByVal sRange As String) As Long
- Declare Function Excel_Sheet_Paste lib "xBot.dll" Alias "Excel_Sheet_Paste" (ByVal objSheet As Long, ByVal iRow As Long, ByVal iCol As Long, ByVal iPaste As Long) As Long
- Declare Function Excel_Sheet_PasteS lib "xBot.dll" Alias "Excel_Sheet_PasteSA" (ByVal objSheet As Long, ByVal sRange As String, ByVal iPaste As Long) As Long
- Declare Function Excel_Sheet_PasteAppend lib "xBot.dll" Alias "Excel_Sheet_PasteAppend" (ByVal objSheet As Long, ByVal iPaste As Long) As Long
- Declare Function Excel_Sheet_ClearRange lib "xBot.dll" Alias "Excel_Sheet_ClearRange" (ByVal objSheet As Long, ByVal iRowS As Long, ByVal iColS As Long, ByVal iRowE As Long, ByVal iColE As Long) As Long
- Declare Function Excel_Sheet_ClearRangeS lib "xBot.dll" Alias "Excel_Sheet_ClearRangeSA" (ByVal objSheet As Long, ByVal sRange As String) As Long
- Declare Function Excel_Sheet_ClearRangeText lib "xBot.dll" Alias "Excel_Sheet_ClearRangeText" (ByVal objSheet As Long, ByVal iRowS As Long, ByVal iColS As Long, ByVal iRowE As Long, ByVal iColE As Long) As Long
- Declare Function Excel_Sheet_ClearRangeTextS lib "xBot.dll" Alias "Excel_Sheet_ClearRangeTextSA" (ByVal objSheet As Long, ByVal sRange As String) As Long
- Declare Function Excel_Sheet_ClearRangeFormat lib "xBot.dll" Alias "Excel_Sheet_ClearRangeFormat" (ByVal objSheet As Long, ByVal iRowS As Long, ByVal iColS As Long, ByVal iRowE As Long, ByVal iColE As Long) As Long
- Declare Function Excel_Sheet_ClearRangeFormatS lib "xBot.dll" Alias "Excel_Sheet_ClearRangeFormatSA" (ByVal objSheet As Long, ByVal sRange As String) As Long
- Declare Function Excel_Sheet_DeleteRange lib "xBot.dll" Alias "Excel_Sheet_DeleteRange" (ByVal objSheet As Long, ByVal iRowS As Long, ByVal iColS As Long, ByVal iRowE As Long, ByVal iColE As Long, ByVal iShift As Long) As Long
- Declare Function Excel_Sheet_DeleteRangeS lib "xBot.dll" Alias "Excel_Sheet_DeleteRangeSA" (ByVal objSheet As Long, ByVal sRange As String, ByVal iShift As Long) As Long
- Declare Function Excel_Sheet_SetPageHeader lib "xBot.dll" Alias "Excel_Sheet_SetPageHeaderA" (ByVal objSheet As Long, ByVal sText As String) As Long
- Declare Function Excel_Sheet_SetPageFooter lib "xBot.dll" Alias "Excel_Sheet_SetPageFooterA" (ByVal objSheet As Long, ByVal sText As String) As Long
- Declare Function Excel_Sheet_SetPageSetup lib "xBot.dll" Alias "Excel_Sheet_SetPageSetup" (ByVal objSheet As Long, ByVal iTop As Double, ByVal iBottom As Double, ByVal iLeft As Double, ByVal iRight As Double, ByVal iHeader As Double, ByVal iFooter As Double, ByVal bCenterH As Long, ByVal bMiddleV As Long) As Long
- Declare Function Excel_Sheet_PrintPreview lib "xBot.dll" Alias "Excel_Sheet_PrintPreview" (ByVal objSheet As Long) As Long
- Declare Function Excel_Sheet_Print lib "xBot.dll" Alias "Excel_Sheet_Print" (ByVal objSheet As Long) As Long
- Declare Function Excel_Range_AddComment lib "xBot.dll" Alias "Excel_Range_AddCommentA" (ByVal As Long objRange, ByVal sText As String) As Long
- Declare Function Excel_Range_ClearComments lib "xBot.dll" Alias "Excel_Range_ClearComments" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_Copy lib "xBot.dll" Alias "Excel_Range_Copy" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_Cut lib "xBot.dll" Alias "Excel_Range_Cut" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_Paste lib "xBot.dll" Alias "Excel_Range_Paste" (ByVal objRange As Long, ByVal iPaste As Long) As Long
- Declare Function Excel_Range_Delete lib "xBot.dll" Alias "Excel_Range_Delete" (ByVal objRange As Long, ByVal iShift As Long) As Long
- Declare Function Excel_Range_Clear lib "xBot.dll" Alias "Excel_Range_Clear" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_ClearContents lib "xBot.dll" Alias "Excel_Range_ClearContents" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_ClearFormats lib "xBot.dll" Alias "Excel_Range_ClearFormats" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_Select lib "xBot.dll" Alias "Excel_Range_Select" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_PrintPreview lib "xBot.dll" Alias "Excel_Range_PrintPreview" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_Print lib "xBot.dll" Alias "Excel_Range_Print" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_RowCount lib "xBot.dll" Alias "Excel_Range_RowCount" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_ColCount lib "xBot.dll" Alias "Excel_Range_ColCount" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_CellCount lib "xBot.dll" Alias "Excel_Range_CellCount" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_SetFont lib "xBot.dll" Alias "Excel_Range_SetFontA" (ByVal objRange As Long, ByVal sFont As String, ByVal iSize As Long, ByVal bBold As Long, ByVal bItalic As Long, ByVal bUnder As Long, ByVal bStrike As Long) As Long
- Declare Function Excel_Range_SetColor lib "xBot.dll" Alias "Excel_Range_SetColor" (ByVal objRange As Long, ByVal iTextColor As Long, ByVal iBackColor As Long, ByVal iBorderColor As Long) As Long
- Declare Function Excel_Range_SetFormat lib "xBot.dll" Alias "Excel_Range_SetFormatA" (ByVal objRange As Long, ByVal sFormat As String) As Long
- Declare Function Excel_Range_SetFormula lib "xBot.dll" Alias "Excel_Range_SetFormulaA" (ByVal objRange As Long, ByVal sFormula As String) As Long
- Declare Function Excel_Range_HasFormula lib "xBot.dll" Alias "Excel_Range_HasFormula" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_GetFormula lib "xBot.dll" Alias "Excel_Range_GetFormulaA" (ByVal objRange As Long) As String
- Declare Function Excel_Range_GetText lib "xBot.dll" Alias "Excel_Range_GetTextA" (ByVal objRange As Long) As String
- Declare Function Excel_Range_SetText lib "xBot.dll" Alias "Excel_Range_SetTextA" (ByVal objRange As Long, ByVal sText As String) As Long
- Declare Function Excel_Range_GetNumber lib "xBot.dll" Alias "Excel_Range_GetNumber" (ByVal objRange As Long) As Double
- Declare Function Excel_Range_SetNumber lib "xBot.dll" Alias "Excel_Range_SetNumber" (ByVal objRange As Long, ByVal dData As Double) As Long
- Declare Function Excel_Range_GetInt lib "xBot.dll" Alias "Excel_Range_GetInt" (ByVal objRange As Long) As Long
- Declare Function Excel_Range_SetInt lib "xBot.dll" Alias "Excel_Range_SetInt" (ByVal objRange As Long, ByVal iData As Long) As Long
- Declare Function Excel_Range_SetWrapText lib "xBot.dll" Alias "Excel_Range_SetWrapText" (ByVal objRange As Long, ByVal bWrap As Long) As Long
- Declare Function Excel_CheckFile lib "xBot.dll" Alias "Excel_CheckFile" (ByVal sFile As String, ByVal bLooseMode As Long) As Long
复制代码这些定义就是 xBot.dll 中提供的 Excel 操作函数,定义后我们可以使用这些函数来进行 Excel 自动化了。 我们希望自己该怎样去操作 Excel 呢?如果是我的话,我希望用一行代码打开 Excel 文件,然后用一行代码就能读取到 Excel 的文件内容,最后再用一行代码关闭 Excel 文件,我不是很关心 【Excel 应用】这样的概念。 因此我设计的接口是: OpenExcel(文件路径) ReadExcel(对象, 表名, 要读取的位置) WriteExcel(对象, 表名, 要写入的内容, 要写入的位置)CloseExcel(对象) 首先是打开Excel文件的实现: - Function OpenExcel(sFile)
- Dim objExcel = Excel_Create()
- End Function
复制代码
|