Skip to content

Commit 2af15cc

Browse files
author
Chris White
committed
Use Scripting.Dictionary to support Word
On Word, `Dictionary` is ambiguous, since it could be `Word.Dictionary` or `Scripting.Dictionary`. Specify `Scripting` to avoid compilation failures.
1 parent e7af4a0 commit 2af15cc

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ For an advanced example of what is possible with vba-test, check out the [tests
5757

5858
1. Download the [latest release (v2.0.0-beta.3)](https://github.com/vba-tools/vba-test/releases)
5959
2. Add `src/TestSuite.cls`, `src/TestCase.cls`, add `src/ImmediateReporter.cls` to your project
60-
3. If you're starting from scratch with Excel, you can use `vba-test-blank.xlsm`
60+
3. In the VBA Editor, select Tools | References and make sure `Microsoft Scripting Runtime` is checked
61+
62+
If you're starting from scratch with Excel, you can use `vba-test-blank.xlsm`
6163

6264
If you're updating from Excel-TDD v1, follow these [upgrade details](https://github.com/VBA-tools/vba-test/pull/23#issuecomment-416606307).
6365

src/TestCase.cls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Private pFailures As VBA.Collection
2626
' --------------------------------------------- '
2727

2828
Public Name As String
29-
Public Context As Dictionary
29+
Public Context As Scripting.Dictionary
3030

3131
Public Planned As Long
3232
Public Successes As Long
@@ -575,7 +575,7 @@ Private Function Indent(Optional Indentation As Long)
575575
End Function
576576

577577
Private Sub Class_Initialize()
578-
Set Me.Context = New Dictionary
578+
Set Me.Context = New Scripting.Dictionary
579579
Set pFailures = New VBA.Collection
580580
End Sub
581581

tests/Tests_TestCase.bas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ Sub PassingAssertions(Suite As TestSuite)
109109

110110
.IsEqual A, B
111111

112-
Set A = New Dictionary
112+
Set A = New Scripting.Dictionary
113113
A("a") = 1
114114
A("b") = 2
115115

116-
Set B = New Dictionary
116+
Set B = New Scripting.Dictionary
117117
B("a") = 1
118118
B("b") = 2
119119

@@ -136,11 +136,11 @@ Sub PassingAssertions(Suite As TestSuite)
136136

137137
.NotEqual A, B
138138

139-
Set A = New Dictionary
139+
Set A = New Scripting.Dictionary
140140
A("a") = 1
141141
A("b") = 2
142142

143-
Set B = New Dictionary
143+
Set B = New Scripting.Dictionary
144144
B("a") = 2
145145
B("b") = 1
146146

0 commit comments

Comments
 (0)