当前位置:文档之家› 常用内部函数.doc

常用内部函数.doc

常用内部函数数学函数
字符串函数
日期和时间函数
增减口期函数:DateAdd(要增减口期形式,增减量,要增减的口期) 例:计算2 周后的日期:DateAdd(”ww”,2,#9/1/2006#),结果"2006-9-15n
求日期Z差函数:DateDiffC要间隔日期形式,日期一,日期二)
例:计算生日还有多少天:DateDiff(”d”, Now, # 12/1/2006#),结果为74
函数中的“要增减口期形式”或“要间隔口期形式”可参见卜•表中的形式:
数据类型转换函数
Sub Appdoc(ByValdocpath As String, ByVai txt As String)'追加记录函数Open docpath For Append As #1
Print #1, txt
Close #1
End Sub
Public Function openfile(ByValfilepath As String) As String'读入文件函数Dim s As String
Open filepath For Input As #1
While Not EOF(1)
Line In put #1, sline
s = s &sline&vbCrLf
Wend
Close #1
ope nfile = s
End Function
Public Function savefile(ByValfilepath As String, ByVai txt As String)'保存文件函数
Open filepath For Output As #1
Print #1, txt
Close #1
End Function
Private Sub Command1_Click()
Dim I As Integer
Open H C:\1 .TXT" For Output As #1
For I = 1 To 4
Print #1, InputBoxf*请输入您的第”& I & ”笔数据:”)
Next
Close #1
MsgBox M去 C 盘看看 1 .TXT 吧!”,, ,,A_AH
End Sub
去除
Private Sub Form_Load()
Commandl.Caption = ”写入数据"
End Sub
Private Sub Command1_Click()
Dim I As Integer
Open H C:\1 .TXT” For Output As #1
For I = 1 To 4
Print #1, InputBoxf*请输入您的第”& I & ”笔数据:”)
Next
Close #1
MsgBox ”去C 盘看看1 .TXT 吧匚,,,A_AH
End Sub
Private Sub Form_Load()
Commandl.Caption = ”写入数据”End Sub。

相关主题