@@ -8,7 +8,7 @@ Attribute VB_Creatable = False
8
8
Attribute VB_PredeclaredId = False
9
9
Attribute VB_Exposed = False
10
10
' -----------------------------------------------------------------------
11
- ' kintoneDataReaderforVBA v1.2 .0
11
+ ' kintoneDataReaderforVBA v1.3 .0
12
12
' -Dictionary.cls と JsonConverter.bas のインポートが必要です。下記から取得してください。
13
13
' Dictionary.cls:v1.4.1で動作確認
14
14
' https://github.com/VBA-tools/VBA-Dictionary
@@ -497,11 +497,7 @@ Public Function RecordFields(Optional ByVal existsPropOnly As Boolean = True) As
497
497
isTarget = True
498
498
End If
499
499
If isTarget Then
500
- If Sgn(resultFields) = 0 Then
501
- ReDim resultFields(0 )
502
- Else
503
- ReDim Preserve resultFields(UBound(resultFields) + 1 )
504
- End If
500
+ Call incrimentArray (resultFields)
505
501
resultFields(UBound(resultFields)) = CStr(f)
506
502
End If
507
503
Next
@@ -603,11 +599,7 @@ Public Function RecordArray(Optional ByVal addFieldLabel As Boolean = True, Opti
603
599
fieldsOrg = Me.RecordFields(existsPropOnly)
604
600
For k = LBound(fieldsOrg) To UBound(fieldsOrg)
605
601
If Me.FieldType(CStr(fieldsOrg(k))) <> "SUBTABLE" Then
606
- If Sgn(fields) = 0 Then
607
- ReDim fields(0 )
608
- Else
609
- ReDim Preserve fields(UBound(fields) + 1 )
610
- End If
602
+ Call incrimentArray (fields)
611
603
fields(UBound(fields)) = fieldsOrg(k)
612
604
End If
613
605
Next
@@ -718,9 +710,12 @@ Public Function RemoveTags(ByVal str As String, ByVal typ As RemoveTagsEnum) As
718
710
Set doc = CreateObject("htmlfile" )
719
711
Call doc .write (str)
720
712
Dim retStr As String
721
- retStr = doc.FirstChild.innerText
722
- If typ = RemoveTagsEnum.RemoveAll Then
723
- retStr = Replace(Replace(Replace(retStr, vbCr, "" ), vbCrLf, "" ), vbLf, "" )
713
+ If doc.FirstChild Is Nothing Then
714
+ Else
715
+ retStr = doc.FirstChild.innerText
716
+ If typ = RemoveTagsEnum.RemoveAll Then
717
+ retStr = Replace(Replace(Replace(retStr, vbCr, "" ), vbCrLf, "" ), vbLf, "" )
718
+ End If
724
719
End If
725
720
RemoveTags = retStr
726
721
End If
@@ -1102,6 +1097,25 @@ Private Function getErrorMessage(ByVal num As KTN_VBA_EXCEPTION) As String
1102
1097
End Select
1103
1098
getErrorMessage = result
1104
1099
End Function
1100
+
1101
+ ''' <summary>
1102
+ ''' incrimentArray
1103
+ ''' </summary>
1104
+ ''' <param name="rArray"></param>
1105
+ Private Sub incrimentArray (ByRef rArray() As String )
1106
+
1107
+ On Error GoTo ErrHandler
1108
+ ReDim Preserve rArray(UBound(rArray) + 1 )
1109
+
1110
+ Exit Sub
1111
+
1112
+ ErrHandler:
1113
+ If Err.Number = 9 Then
1114
+ ReDim rArray(0 )
1115
+ Else
1116
+ Err.Raise (Err.Number)
1117
+ End If
1118
+ End Sub
1105
1119
Private Sub Class_Initialize ()
1106
1120
Me.Lang = ""
1107
1121
Me.IsName = True
0 commit comments