• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            S.l.e!ep.¢%

            像打了激速一樣,以四倍的速度運(yùn)轉(zhuǎn),開(kāi)心的工作
            簡(jiǎn)單、開(kāi)放、平等的公司文化;尊重個(gè)性、自由與個(gè)人價(jià)值;
            posts - 1098, comments - 335, trackbacks - 0, articles - 1
              C++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

            VBScript讀取 Excel 與 寫(xiě)入 Excel

            Posted on 2008-10-21 21:41 S.l.e!ep.¢% 閱讀(3441) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): VBScript
            Function ?GetCellValue(excelSheet,?row,?column,?path)
            ????????
            on ? error ? resume ? next
            ????????
            Set ?Wshshell? = ? CreateObject ( " Wscript.shell " )
            ????????
            Set ?ExcelApp? = ? CreateObject ( " excel.Application " )
            ????????ExcelApp.Visible?
            = ? True
            ????????
            Set ?newBook? = ?ExcelApp.Workbooks.Open(path)
            ????????
            If ??Err? = ? 0 ? Then
            ????????????????
            Set ?excelSheet? = ?ExcelApp.ActiveSheet
            ????????????????GetCellValue?
            = ?excelSheet.Cells(row,?column)
            ????????????????ExcelApp.Quit
            ????????????????Wshshell.Popup?GetCellValue,
            2 , " 獲取的Excel單元格的值為: " , 0 + 64
            ?????????
            Else
            ????????????????Wshshell.Popup?
            " 請(qǐng)確認(rèn)文件是否已經(jīng)創(chuàng)建 " , 3 , " 文件不存在 " , 0 + 64
            ????????????????ExcelApp.Quit
            ?????????
            End ? If
            End?Function
            Call ?GetCellValue( " excel " , 9 , 9 , " E:/excel.xls " )

            寫(xiě)入:
            Function ?WExcel(row,col,value,path)
            ????????
            Set ?Wshshell? = ? Createobject ( " Wscript.shell " )
            ????????Err?
            = ? 0
            ????????
            on ? error ? resume ? next
            ????
            Dim ?fso,f
            ????
            Set ?fso? = ? CreateObject ( " Scripting.FileSystemObject " )
            ????
            Set ?f? = ?fso.GetFile(path)
            ???????????
            Set ?ExcelApp? = ? CreateObject ( " Excel.Application " )
            ????????ExcelApp.Visible?
            = ? true
            ????????
            If ??Err? = ? 0 ? Then
            ????????????????
            Set ?newBook? = ?ExcelApp.Workbooks.Open(path)
            ????????????????newBook.Worksheets(
            1 ).Activate
            ????????????????newBook.Worksheets(
            1 ).Cells(row,col).value = value
            ????????????????newBook.Worksheets(
            1 ).Name = " excel "
            ????????????????newBook.Save
            ????????????????ExcelApp.Application.quit
            ????????????????
            set ?newBook? = ? nothing
            ????????????????
            Set ?ExcelApp? = ? nothing
            ?????????
            Elseif ?Err? = ? 53 ? Then
            ????????????????
            Set ?newBook? = ?ExcelApp.Workbooks.Add
            ????????????????newBook.Worksheets(
            1 ).Activate
            ????????????????newBook.Worksheets(
            1 ).Cells(row,col).value = value?????????????????
            ????????????????newBook.Worksheets(
            1 ).Name = " excel "
            ????????????????newBook.SaveAs?path
            ????????????????ExcelApp.Application.quit
            ????????????????
            set ?newBook? = ? nothing
            ????????????????
            Set ?ExcelApp? = ? nothing
            ?????????
            Else
            ????????????????Wshshell.Popup?
            " 發(fā)生未知錯(cuò)誤 " ,? 5 ,? " 無(wú)法繼續(xù) " , 0 + 32 ????????
            ?????????
            End ? If
            End?Function
            Call ?WExcel( 9 , 9 , " liuyi " , " E:/excel.xls " )
            久久婷婷色综合一区二区| 久久国产精品一区二区| 伊人久久综合热线大杳蕉下载| 久久久久亚洲Av无码专| 久久国产亚洲高清观看| 99久久精品国产一区二区三区 | 99999久久久久久亚洲| 久久人人爽人人爽人人片AV麻烦| 日韩精品无码久久久久久| 久久九九亚洲精品| 久久久久久噜噜精品免费直播| 久久99热狠狠色精品一区| 国产99久久久国产精品~~牛 | 久久精品不卡| 亚洲伊人久久精品影院| 久久中文字幕一区二区| 亚洲国产精品无码久久久不卡| 亚洲成色www久久网站夜月| 91精品国产91热久久久久福利| 久久伊人五月丁香狠狠色| 国产成人精品久久综合| 无码人妻精品一区二区三区久久久| 国产成人99久久亚洲综合精品| 久久久久AV综合网成人| 亚洲va国产va天堂va久久| 亚洲精品高清一二区久久| 91精品国产乱码久久久久久| 久久精品免费全国观看国产| 久久久久亚洲精品天堂久久久久久 | 久久久久久亚洲精品成人| 2021久久精品免费观看| 久久影视综合亚洲| 精品久久综合1区2区3区激情| 久久精品国产亚洲AV嫖农村妇女| 一本一本久久a久久精品综合麻豆| 国产99久久久国产精免费| 久久这里只有精品首页| 久久播电影网| 亚洲国产成人精品无码久久久久久综合| 丰满少妇人妻久久久久久4| 久久国产精品久久国产精品|