Dim regEx,Matches,Match,TempStr,ReturnValue,LoopVar
Dim NotReplaceLable,ReplaceLableTF
Set regEx = New RegExp
regEx.Pattern = "{%=[^{%]*%}"
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(Content)
ReplaceAllFlag = Content
ReplaceAllFlag = Replace(ReplaceAllFlag, "{$PublicDate}", PUBLICMONTH & GetRandomDay) ' 发行日期
ReplaceAllFlag = Replace(ReplaceAllFlag, "{$PublicMonth}", PUBLICMONTH ) ' 发行日期
ReplaceAllFlag = Replace(ReplaceAllFlag, "{$PublicYear}", PUBLICYEAR) ' 发行日期
For Each Match in Matches
TempStr = Match.Value
TempStr = Replace(TempStr,Chr(13) & Chr(10),"")
TempStr = Replace(TempStr,"{%=","")
TempStr = Replace(TempStr,"%}","")
TempStr = Left(TempStr,Instr(TempStr,"(")-1) & "," & Mid(TempStr,InStr(TempStr,"(")+1)
TempStr = Left(TempStr,InStrRev(TempStr,")")-1)
TempStr = Replace(TempStr,"""","")
ReturnValue = GetmodelContent(TempStr)
ReplaceAllFlag = Replace(ReplaceAllFlag,Match.Value,ReturnValue) 错误行
Next
End Function
2 个解决方案
#1
VB?UP。。
#2
ReturnValue = GetmodelContent(TempStr)
查一下返回的是ReturnValue 是不是Null
If IsNull(ReturnValue) Then ReturnValue = ""
查一下返回的是ReturnValue 是不是Null
If IsNull(ReturnValue) Then ReturnValue = ""
#1
VB?UP。。
#2
ReturnValue = GetmodelContent(TempStr)
查一下返回的是ReturnValue 是不是Null
If IsNull(ReturnValue) Then ReturnValue = ""
查一下返回的是ReturnValue 是不是Null
If IsNull(ReturnValue) Then ReturnValue = ""