




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、VB 中對(duì) Excel 編程操作實(shí)例vb excel 編程技巧 ,實(shí)例 ,格式 ,合并單元格,表格線,頁(yè)面橫向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 = "臺(tái) ," Else tmp2 = " 個(gè),"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' 頁(yè)面為橫向End With 98If toexcel = 1 ThenIf abcd = True Then tmp2 = " 臺(tái)數(shù)據(jù) " Else tmp2 = " 個(gè)數(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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 系統(tǒng)安全策略與應(yīng)急響應(yīng)計(jì)劃考核試卷
- 節(jié)假日促銷活動(dòng)渠道創(chuàng)新考核試卷
- 供應(yīng)鏈智能化風(fēng)險(xiǎn)評(píng)估考核試卷
- 印刷行業(yè)市場(chǎng)細(xì)分策略與消費(fèi)者需求匹配研究考核試卷
- java面試題及答案游覽器輸入網(wǎng)址
- 市場(chǎng)動(dòng)態(tài)與風(fēng)險(xiǎn)預(yù)警系統(tǒng)構(gòu)建考核試卷
- 光學(xué)時(shí)間分辨技術(shù)在環(huán)境監(jiān)測(cè)中的應(yīng)用考核試卷
- 肥皂雕刻面試題及答案
- 2025年稅務(wù)師試題及答案
- 情景營(yíng)銷考試題及答案
- 道路養(yǎng)管協(xié)議書
- 2025年河北省專技人員公需課《人工智能時(shí)代的機(jī)遇與挑戰(zhàn)-預(yù)訓(xùn)練大模型與生成式AI》答案
- 靜脈治療個(gè)案匯報(bào)
- 煤礦雨季三防防洪事故專項(xiàng)應(yīng)急預(yù)案
- GB/T 45451.2-2025包裝塑料桶第2部分:公稱容量為208.2 L至220 L的不可拆蓋(閉口)桶
- 正畸器械知識(shí)培訓(xùn)課件
- 2025年師德師風(fēng)知識(shí)競(jìng)賽題庫(kù)(含參考答案)
- 安裝倉(cāng)庫(kù)燈具協(xié)議書
- 輔導(dǎo)員職業(yè)素養(yǎng)測(cè)試試題及答案
- 智慧檢驗(yàn)與大數(shù)據(jù)分析知到課后答案智慧樹章節(jié)測(cè)試答案2025年春溫州醫(yī)科大學(xué)
- WEF -2025全球燈塔網(wǎng)絡(luò):全球燈塔網(wǎng)絡(luò) 推動(dòng)思維轉(zhuǎn)變 數(shù)字轉(zhuǎn)型中的影響和規(guī)模 轉(zhuǎn)變白皮書
評(píng)論
0/150
提交評(píng)論