Question:

(VBA) Run-time error '91' Object variable or With block variable not set?

by  |  earlier

0 LIKES UnLike

What does this error mean and what is the solution in VBA?

Run-time error '91'

Object variable or With block variable not set

This error occurs with the code, I'm not finding which exactly causing the error :

The declarations in a module

Public DGroup As DUOSObjects

Public DObj As DUOSObject

This the line with error :

DObj.Properties("Percent").Value = Credits

 Tags:

   Report

2 ANSWERS


  1. Most likely you haven't actually created the object.  Using Dim or Public to *define* it doesn't make it exist.

    Set DObj = new DUOSObject

    will create it.  You still need to define it as you have.


  2. Try:

    With DObj

    .Properties("Percent").Value = Credits

    End With

    or

    With DObj.Properties("Percent")

    .Value = Credits

    End With

    I can't give many more suggestions without seeing this DUOSObject class.

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.