VBA - 带有字符串公式的变量
VBA - Variables with formulas to String
我正在尝试在 VBA 代码中的变量内创建公式。
当代码开始创建邮件部分时,它会崩溃。
numer
怎么了?
Dim numer As Integer
Dim day As Integer
day = WorksheetFunction.TODAY()
numer = WorksheetFunction.WeekNum(day, 1)
With OutMail
.Subject = "text text" & CStr(numer) & " text text"
VBA 不允许使用 TODAY() 函数。请改用 Date 函数。此外,一个整数最多只能容纳 32,767 个值。请改用 long。
Private Sub this()
Dim numer As Integer
Dim day As Long
day = Date
numer = WorksheetFunction.WeekNum(day, 1)
我正在尝试在 VBA 代码中的变量内创建公式。 当代码开始创建邮件部分时,它会崩溃。
numer
怎么了?
Dim numer As Integer
Dim day As Integer
day = WorksheetFunction.TODAY()
numer = WorksheetFunction.WeekNum(day, 1)
With OutMail
.Subject = "text text" & CStr(numer) & " text text"
VBA 不允许使用 TODAY() 函数。请改用 Date 函数。此外,一个整数最多只能容纳 32,767 个值。请改用 long。
Private Sub this()
Dim numer As Integer
Dim day As Long
day = Date
numer = WorksheetFunction.WeekNum(day, 1)