7,763
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private Declare Function GetWindowsDirectory Lib "kernel32.dll" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Sub Form_Load()
Dim WinDir As String * 256, S As String
Call GetWindowsDirectory(WinDir, 256)
S = Trim(WinDir)
Debug.Print Len(S) '结果为256
Debug.Print Len(Left(WinDir, InStr(WinDir, vbNullChar) - 1)) '结果为10
End Sub
left(space,instr(1,space,vbnullchar)-1)
Private Sub Command1_Click()
Dim strTemp As String
strTemp = "asdf df"
Debug.Print strTemp
Debug.Print Trim(strTemp)
End Sub
Private Sub Command1_Click()
Dim strTemp As String
strTemp = "asdf" & Space(10)
Debug.Print strTemp
Debug.Print Trim(strTemp) & "end"
End Sub