0

I bought a surface Pro recently with Office 365 and decided to write a poker game to learn how to code in VBA. I have it running but then decided to learn how to use pictures. So I downloaded vbcards.ocx and referenced it to my project.

I have a user form and inserted an image control (image1). I then tried the following two lines of code:

  1. Deck1.ChangeCard = 1
  2. Image1.Picture = Deck1.Picture

The code falls on the first line with a run time error code 424 (object required).

I cant see anything wrong with the reference (Playing Cards for Visual Basic checkbox is ticked)

Cant think of why it is not recognizing the object (Deck1).

Apologies if this is an easy one for someone.

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
  • 4
    Please improve your question and add a [mcve]. – Pᴇʜ Jan 07 '20 at 08:07
  • Not enough information to move beyond the realm of speculation. It could be that `Deck1` is not declared as an object; or it could be that `Deck1.ChangeCard` expects an object; or it could be obfuscated by error handling and unrelated to either of those. If the correct library is referenced and you use early binding then intellisense should kick in when you type `Deck1.` If it doesn't, then you know your declaration is wrong or you have an error in the preceding code. But if it does, then your object is declared properly and you may want to use the object explorer to verify expected types. – ProfoundlyOblivious Jan 08 '20 at 03:05

0 Answers0