Now
傳回 Variant (Date),包含日期與時間
Date
傳回含日期之 Variant(Date)
edisonx 發表在 痞客邦 留言(0) 人氣(6,898)
' ------------------------------------------------------------
' 查看目前開啟excel檔案數量
Dim OpenCnt as Integer
OpenCnt = Application.Workbooks.Count
' ------------------------------------------------------------
' 依序查已開檔名 - 方法一
Dim i As Integer
For i = 1 To Workbooks.Count
MsgBox i & " " & Workbooks(i).Name
Next
edisonx 發表在 痞客邦 留言(0) 人氣(45,791)
' ---------------------------------------------------------------
' 1. 等待時間
Sub WaitTime(Sec As Integer)
Application.Wait (Now() + VBA.TimeValue("00:00:" & Sec))
End Sub
edisonx 發表在 痞客邦 留言(0) 人氣(5,494)
------------------------------------------------------------------------------------------------
Sub Mult1() ' do while loop
Dim msg As String, i As Integer, j As Integer
i = 1: j = 1
Do While i <= 9
j = 1
Do While j <= 9
msg = msg & j & "*" & i & "=" & i * j & " "
j = j + 1
Loop
msg = msg & vbCrLf
i = i + 1
Loop
MsgBox msg
End Sub
edisonx 發表在 痞客邦 留言(0) 人氣(9,649)
1. If-Then
If 條件 Then
敘述
End If
edisonx 發表在 痞客邦 留言(0) 人氣(85,428)
算術運算子
+ - * 加減乘
/ 傳回小數之除法
\ 傳回整數之除法
edisonx 發表在 痞客邦 留言(0) 人氣(15,984)
用 Type 去自定義,假設要定義 "學生" (Student) 這個資料型態,紀錄 "姓名、學號、年紀、出生日期" 特性,可這麼做
Type Student
Name As String ' 姓名
No As String ' 學號
Age As Integer ' 年紀
Birthday As Date ' 生日
End Type
使用時可這麼用
Dim Edison As Student
Edison.Name = "EidsonX"
Edison.No = "X0000001"
Edison.Age = 18
Edison.Birthday = "1990/1/1"
edisonx 發表在 痞客邦 留言(0) 人氣(3,287)
Byte
短整數,1Byte,0~255
Boolean
布林值,2 Bytes,True or False
edisonx 發表在 痞客邦 留言(0) 人氣(46,314)

每個 Module 內通常會有多個 Procedure (如同 C 語言的 Header - Function),在此只簡介 Procedure 一些特性。
1. 所有 Procedure 都是由 Sub (程式碼) End Sub 與 Function(程式碼) End Function 所成的。
2. 即使如此, Sub 與 Function 仍有不同之處。
edisonx 發表在 痞客邦 留言(2) 人氣(49,843)