首页->【软件工具包使用(SW/Software Tools Usage)】

6 1

子函数调用
Dim strdiffList As String
Dim strChrFlwStp(5) As String
Dim strChrSHMFlwStp(5) As String


StrCompare strChrFlwStp, strChrSHMFlwStp, blnChkRes, strdiffList

Public Function StrCompare(ByRef strSrc() As String, _
                                  ByRef strDst() As String, _
                                  ByRef res As Boolean, _
                                  ByRef diffList As String) As Long
 Dim i    As Integer
 Dim j    As Integer
 
 Dim blnResTrue As Boolean
 Dim blnResFalse As Boolean
 
  j = 0

 For i = LBound(strSrc) To UBound(strSrc)
             If strSrc(i) = strDst(i) Then
                 blnResTrue = True
                 diffList = diffList & "OK" & ","
            Else
                 diffList = diffList & "," & CStr(i)
                 j = j + 1
                 blnResFalse = False
             End If
 Next i
 res = blnResTrue And blnResFalse

2.VBA 写文件

Dim strLogFilePath As String

strLogFilePath = "F:\DesktopSHi\VBA\chklog.log"
strUserName = Environ("username")
strChkDateTime = Format(Date, "yyyy-mm-dd") & " " & Format(Time, "hh:mm")
 
Open strLogFilePath For Output As #1
'****************wr info about review into log file**********************
Write #1, "Project Review User " & strUserName
Write #1, "Project Review at " & strChkDateTime
Write #1, "Now,Start reviewing  the project...."
Write #1, "                                    "

Close #1

写文件调试结果:

图片.png

在这里发现,输出的log都包含了“”问题解决:使用 print 函数而不是 write
图片.png

作者于2019-04-21 11:59:27修改!
楼主可见

  1. shwnyoo 1#

    ***此内容已隐藏,只有楼主可见***