57 lines
1.4 KiB
VB.net
57 lines
1.4 KiB
VB.net
Attribute VB_Name = "工作表1"
|
|
Private Sub CommandButton21_Click()
|
|
' Application.Caption = PYEAR & Worksheets("售價").Cells(3, 1)
|
|
Dim oSB As Object
|
|
Set oSB = CreateObject("System.Text.StringBuilder")
|
|
|
|
oSB.AppendFormat_5 Nothing, "hello {0}", Array("simon")
|
|
Debug.Assert oSB.ToString = "hello simon"
|
|
|
|
End Sub
|
|
|
|
'Private Sub sample()
|
|
' Dim exl As Excel.Application
|
|
' Dim wb As Excel.Workbook
|
|
' Dim i As Integer
|
|
' Dim j As Integer
|
|
' Dim cnt As Integer
|
|
' Dim cn As New ADODB.Connection
|
|
' Dim t1 As Date
|
|
' Dim t2 As Date
|
|
' Dim t As Date
|
|
'
|
|
' t1 = Now
|
|
'
|
|
' Set exl = CreateObject("Excel.Application")
|
|
' Set wb = exl.Workbooks.Add
|
|
'
|
|
' exl.ActiveWorkbook.SaveAs (Excel.ThisWorkbook.Path & "\sample3.xls")
|
|
' exl.ActiveWorkbook.Close
|
|
' exl.Quit
|
|
'
|
|
' cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
|
|
' "Data Source=" & Excel.ThisWorkbook.Path & "\sample3.xls;" & _
|
|
' "Extended Properties=""Excel 8.0;HDR=YES;IMEX=0"""
|
|
'
|
|
' cn.Execute "CREATE TABLE [工作表1$] (R INT, G INT, B INT)"
|
|
' cn.Execute "UPDATE [工作表1$] SET R = 0"
|
|
' cn.Execute "UPDATE [工作表1$] SET G = 1"
|
|
' cn.Execute "UPDATE [工作表1$] SET B = 2"
|
|
'
|
|
' cnt = 3
|
|
' For i = 1 To 10000
|
|
' cn.Execute "INSERT INTO [工作表1$] (R,G,B) VALUES (" & cnt & "," & cnt + 1 & "," & cnt + 2 & ")"
|
|
' cnt = cnt + 3
|
|
' Next i
|
|
'
|
|
' cn.Close
|
|
' Set cn = Nothing
|
|
' t2 = Now
|
|
'
|
|
' t = t2 - t1
|
|
'
|
|
' MsgBox Second(t)
|
|
'End Sub
|
|
|
|
|