# VB Help!!!

**URL:** <https://boards.straightdope.com/t/vb-help/57290>\
**Category:** Factual Questions\
**Created:** [March 9, 2001, 1:04am UTC](https://boards.straightdope.com/t/vb-help/57290 "2001-03-09T01:04:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BillyDunny](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@BillyDunny](https://boards.straightdope.com/u/BillyDunny)\
**Post date:** [March 9, 2001, 1:04am UTC](https://boards.straightdope.com/t/vb-help/57290/1 "2001-03-09T01:04:08Z")

</div>

Can anyone tell me what is wrong with this VB code?

Private Sub RSWVBAPage\_afterPlay()

Dim MyDoc As Object  
Dim ICount As Integer  
testerWin = “0”  
Set MyDoc = RSWApp.om.GetTopDocument(testerWin)  
ICount = MyDoc.images.Length  
MsgBox = ICount  
End Sub

---

<div class="post-metadata">

**Author:** ![DarrenS](https://avatars.discourse-cdn.com/v4/letter/d/977dab/32.png) [@DarrenS](https://boards.straightdope.com/u/DarrenS)\
**Post date:** [March 9, 2001, 1:56am UTC](https://boards.straightdope.com/t/vb-help/57290/2 "2001-03-09T01:56:05Z")

</div>

Hi Billy,

Couple of things.

1. If you have “Option Explicit” turned on, the following will fail:

testerWin = “0”

because this variable has not yet been declared.

1. This line is wrong:

MsgBox = ICount

It should be just

MsgBox ICount
