真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb點(diǎn)虐 輸出表格 vbnet formatnumber

VB.NET輸出到Excel的問(wèn)題

一、DCOM修復(fù)

網(wǎng)站建設(shè)哪家好,找成都創(chuàng)新互聯(lián)公司!專注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、微信平臺(tái)小程序開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了云南免費(fèi)建站歡迎大家使用!

1.運(yùn)行:mmc comexp.msc /32,找到我的電腦 - DCom配置中的Microsoft Excel Application

2.在Microsoft Excel Application上點(diǎn)擊右鍵,選擇"屬性"

3.點(diǎn)擊"標(biāo)識(shí)"標(biāo)簽,選擇"交互式用戶"

4.點(diǎn)擊"安全"標(biāo)簽,在"啟動(dòng)和激活權(quán)限"上點(diǎn)擊"自定義",然后點(diǎn)擊對(duì)應(yīng)的"編輯"按鈕,在彈出的"安全性"對(duì)話框中填加一個(gè)"NETWORK SERVICE"用戶(注意要選擇本計(jì)算機(jī)名),并給它賦予"本地啟動(dòng)"和"本地激活"權(quán)限.

5.依然是"安全"標(biāo)簽,在"訪問(wèn)權(quán)限"上點(diǎn)擊"自定義",然后點(diǎn)擊"編輯",在彈出的"安全性"對(duì)話框中也填加一個(gè)"NETWORK SERVICE"用戶,然后賦予"本地訪問(wèn)"權(quán)限.

二、如果找不到Microsoft Excel 應(yīng)用程序

1、進(jìn)行OFFICE菜單中的組件重注冊(cè)

2、如果仍未解決問(wèn)題,點(diǎn) 開始--運(yùn)行--輸入EXCEL文件所在的路徑 “c:\program files\exel.exe” /regserver 進(jìn)行修復(fù)注冊(cè)

參考:

vb點(diǎn)虐 輸出 excel

這里有段VB6.0的,你可以參考。

注意添加引用。

Private Sub Command6_Click()

Dim i, j As Integer

Dim xlApplication As Excel.Application, xlWorkbook As Excel.Workbook, xlSheet

Dim xlApp As Excel.Application

On Error Resume Next

Set xlApplication = GetObject(, "Excel.Application")

Set xlApp = CreateObject("Excel.Application")

If MsgBox("確認(rèn)將文件信息導(dǎo)出到EXCEL中??", vbExclamation + vbYesNo, "警告") = vbYes Then

If Err.Number 0 Then Set xlApplication = CreateObject("Excel.Application")

Set xlWorkbook = xlApplication.Workbooks.Add

Set xlSheet = xlWorkbook.ActiveSheet

xlSheet.Cells(1, 2) = lblcl.Caption

xlSheet.Range("A1:E1").MergeCells = True

xlSheet.Range("A1:E1").HorizontalAlignment = xlCenter

xlSheet.Cells(2, 2).ColumnWidth = 18

For i = 1 To DataGrid1.Columns.Count

xlSheet.Cells(2, 1) = "編號(hào)"

xlSheet.Cells(2, i + 1) = DataGrid1.Columns(i).Caption

For j = 0 To DataGrid1.VisibleRows - 1

xlSheet.Cells(j + 3, 1) = j + 1

xlSheet.Cells(j + 3, i + 1) = DataGrid1.Columns(i).CellText(DataGrid1.RowBookmark(j))

Next j

Next i

xlApplication.Visible = True

Set xlSheet = Nothing

Set xlWorkbook = Nothing

Set xlApplication = Nothing

'xlApp.Range("A2:L2").Columns.Interior.ColorIndex = 40

'xlApp.Range("A2:L2").Borders.LineStyle = xlContinuous

'xlApp.Visible = True

'xlApp.Range(xlSheet.Cells(2 + PartsRs.RecordCount + 1, 1), xlSheet.Cells(2 + PartsRs.RecordCount + 1, 8)).Columns.Interior.ColorIndex = 40

'xlApp.Range(xlSheet.Cells(2 + PartsRs.RecordCount + 1, 1), xlSheet.Cells(2 + PartsRs.RecordCount + 1, 8)).Borders.LineStyle = xlContinuous

Else

MsgBox "無(wú)信息可供您導(dǎo)出,請(qǐng)確認(rèn)!", vbExclamation + vbOKOnly, "警告"

End If

End Sub

在VB點(diǎn)虐 中,如何使幾個(gè)數(shù)組變量按照列表示出來(lái),并輸出到指定的EXCEL表格中!

先在: My Project 中引用 Microsoft Excel 11.0 Object Library(這個(gè)是Excel 2003,Excel 2007 是12.0),之后在窗體代碼中加入相關(guān)內(nèi)容就行了。以下是一個(gè)窗體的簡(jiǎn)單實(shí)例

假設(shè)在C盤根文件夾中有:TEST.xls

Public Class 引用EXCEL窗體

Private A() As String = {"A", "B", "CC", "C", "D"}

Private B() As Integer = {1, 22, 34, 50, 16, 99, 14}

Private excelapp As New Microsoft.Office.Interop.Excel.Application

Private excelworkbook As Microsoft.Office.Interop.Excel.Workbook

Private Sub 引用EXCEL_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim Index As Integer

excelworkbook = excelapp.Workbooks.Open("c:\test.xls")

excelapp.Application.Workbooks.Add(True)

excelapp.Cells(1, 1) = "數(shù)組:A"

For Index = 0 To UBound(A)

excelapp.Cells(Index + 2, 1) = A(Index)

Next

excelapp.Cells(1, 2) = "數(shù)組:B"

For Index = 0 To UBound(B)

excelapp.Cells(Index + 2, 2) = B(Index)

Next

excelapp.Visible = True

End Sub

End Class

運(yùn)行結(jié)果:

數(shù)組:A 數(shù)組:B

A 1

B 22

CC 34

C 50

D 16

99

14


文章標(biāo)題:vb點(diǎn)虐 輸出表格 vbnet formatnumber
瀏覽路徑:http://weahome.cn/article/ddjhiie.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部