




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、VB 中對 Excel 編程操作實例vb excel 編程技巧 ,實例 ,格式 ,合并單元格,表格線,頁面橫向Dim xlApp As excel.ApplicationDim xlBook As excel.WorkbookDim xlSheet As excel.WorksheetSet xlApp = CreateObject("Excel.Application")Set xlBook = xlApp.Workbooks.AddSet xlSheet = xlBook.Worksheets(1)Dim xRange As excel.RangeDim m5 As S
2、tringDim msgss As Boolean'On Error GoTo 99With xlSheetIf abcd = True Then tmp2 = "臺 ," Else tmp2 = " 個,"If dataM > 5 Then m5 = "數(shù)量 :" & dataM &tmp2 Else m5 = " ".Cells(1, 1).Value = lb1.Caption & m5 &Label15.Caption.C
3、ells(2, 1).Value = " 基本信息".Cells(6, 1).Value = " 額定性能" & Chr(10) &Text1.Text & "rpm".Cells(11, 1).Value = " 堵轉(zhuǎn) ".Columns(1).ColumnWidth = 8 ' 表格寬度.Columns(2).ColumnWidth = 18 ' 表格寬度'.Range(.Cells(1, 1), .Cells(1, 5).MergeCel
4、ls = True ' 合并.Range(.Cells(2, 1), .Cells(5, 1).MergeCells = True ' 合并單元格.Range(.Cells(6, 1), .Cells(10, 1).MergeCells = True ' 合并單元格.Range(.Cells(11, 1), .Cells(13, 1).MergeCells = True ' 合并單元格.Range(.Cells(1, 1), .Cells(13, dataM +2).Borders.LineStyle = xlContinuous ' 表格線.Range
5、(.Cells(2, 1), .Cells(13, dataM +2).HorizontalAlignment = xlCenter.Cells(1, 1).Font.Size = 12.Cells(1, 1).Font.Name = " 黑體 ".rowS(1).RowHeight = 30' 行高For i = 2 To 13.rowS(i).RowHeight = 20NextFor i = 0 To dataM.Columns(i + 3).ColumnWidth = 15 ' 表格寬度If i <> 0 Then .Ce
6、lls(2, i + 2).Font.Size = 5.Cells(2, i + 2).Value = Label1(i).CaptionIf dataM > 5 And i <> 0 And abcd = True Then.Cells(3, i + 2).Value = Trim(Left(Right(Label1(i).Caption,7), 3)Else.Cells(3, i + 2).Value = Label2(i).CaptionEnd IfIf i = 0 Or dataM < 6 Then .Cells(3, i + 2
7、).Value =Label2(i).Caption.Cells(4, i + 2).Value = Label3(i).Caption.Cells(5, i + 2).Value = Label4(i).Caption.Cells(6, i + 2).Value = Label5(i).Caption.Cells(7, i + 2).Value = Label6(i).Caption.Cells(8, i + 2).Value = Label7(i).Caption.Cells(9, i + 2).Value = Label8(i).Caption.Cells(10, i + 2).Valu
8、e = Label9(i).Caption.Cells(11, i + 2).Value = Label10(i).Caption.Cells(12, i + 2).Value = Label11(i).Caption.Cells(13, i + 2).Value = Label12(i).Caption'設(shè)置格式'.Columns(10).NumberFormatLocal = "0.00_.rowS(6).NumberFormatLocal = "0.000_ ".rowS(7).NumberFormatLocal = "0.0_ &
9、quot;.rowS(8).NumberFormatLocal = "0.0000_ ".rowS(9).NumberFormatLocal = "0_ ".rowS(10).NumberFormatLocal = "0_ ".rowS(11).NumberFormatLocal = "0.000_ ".rowS(12).NumberFormatLocal = "0.0_ ".rowS(13).NumberFormatLocal = "0_ "'.rowS(7).Hi
10、dden = True'.rowS(8).Hidden = True'.rowS(10).Hidden = True'.rowS(12).Hidden = True'.Names = lb1.Caption.PageSetup.Orientation = 2' 頁面為橫向End With 98If toexcel = 1 ThenIf abcd = True Then tmp2 = " 臺數(shù)據(jù) " Else tmp2 = " 個數(shù)據(jù)If dataM > 5 ThenxlBook.SaveAs File1.Pat
11、h & "" &Right(lb1.Caption, Len(lb1.Caption) - 5) & "(" &dataM & tmp2 & Text1.Text & "rpm).xls"msgss = Truetmp = File1.Path & "" & Right(lb1.Caption,Len(lb1.Caption) - 5) & "(&
12、quot; & dataM & tmp2 & Text1.Text & "rpm).xls"ElseIf Len(pathIs) < 5 ThenxlBook.SaveAs Left(File1.Path, Len(File1.Path) - (Len(File1.Path) - InStrRev(File1.Path, "") & Right(lb1.Caption, Len(lb1.Caption) - 5) & ".xls&quo
13、t;ElsexlBook.SaveAs File1.Path & "" & pathIs& "(" & Text1.Text & "rpm).xls"msgss = Truetmp = File1.Path & "" & pathIs & "("& Text1.Text & "rpm).xls"End IfEnd IfxlBook.Close&
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2031年中國繡花雙面膠帶行業(yè)投資前景及策略咨詢研究報告
- 2025至2031年中國直刀鉆嘴行業(yè)投資前景及策略咨詢研究報告
- 2025至2031年中國漁拓行業(yè)投資前景及策略咨詢研究報告
- 2025至2031年中國手機柜行業(yè)投資前景及策略咨詢研究報告
- 2025至2031年中國多功能門窗個人報警器行業(yè)投資前景及策略咨詢研究報告
- 2025至2031年中國不銹鋼相框行業(yè)投資前景及策略咨詢研究報告
- 2025至2030年中國魚肉干數(shù)據(jù)監(jiān)測研究報告
- 2025至2030年中國膠片用具數(shù)據(jù)監(jiān)測研究報告
- 2025年黑色金屬冶煉及壓延產(chǎn)品合作協(xié)議書
- 2025年新型便攜式溫、濕、風(fēng)向風(fēng)速儀項目發(fā)展計劃
- 2025年鐵嶺衛(wèi)生職業(yè)學(xué)院單招職業(yè)傾向性測試題庫學(xué)生專用
- (一模)2025屆安徽省“江南十?!备呷?lián)考地理試卷(含官方答案)
- 數(shù)學(xué)-2025屆安徽省江南十校聯(lián)考試題和解析
- 2025年遼寧現(xiàn)代服務(wù)職業(yè)技術(shù)學(xué)院單招職業(yè)技能測試題庫(含答案)
- 高考模擬作文“中國游”“city不city”導(dǎo)寫及范文
- 福建省福州市2024-2025學(xué)年九年級上學(xué)期期末語文試題(解析版)
- 普通高中學(xué)生綜合素質(zhì)評價自我陳述報告
- 2025年江西電力職業(yè)技術(shù)學(xué)院高職單招職業(yè)適應(yīng)性測試近5年??及鎱⒖碱}庫含答案解析
- 2025年吉安職業(yè)技術(shù)學(xué)院高職單招職業(yè)技能測試近5年常考版參考題庫含答案解析
- 《展示設(shè)計》課件-第一章 展示設(shè)計概述
- 建筑施工安全管理存在的問題及對策【15000字(論文)】
評論
0/150
提交評論