Towelmonkey
New Member
- Joined
- Jan 12, 2022
- Messages
- 7
- Office Version
- 2016
- 2010
- Platform
- Windows
I'm creating a tetris game in a modeless UserForm which aims to update Image Controls every gametick. However, I'm running into an issue where
"Object variable or With block variable not set"
is displayed every time I try to run the code (which is in a code module), and the error always points to lines of the form
formm.Designer.controls(controlName).Picture = LoadPicture("D:\square.bmp")
I'm using the VBA Extensibility library, and
Dim formm As VBComponent
formm = ....VBComponents.Items("UserForm1")
is delcared at the start of the module, followed by
UserForm1.Show vbModeless
before the block of problematic code.
There is nothing wrong with the spelling etc. of the string controlName, nor of the image file path.
I know that it is possible to load images into an already open UserForm with the use of user inputs like clicks and other buttons. My objective is to make the images load WITHOUT user input, on a time loop. Please advise on how to solve this error.
"Object variable or With block variable not set"
is displayed every time I try to run the code (which is in a code module), and the error always points to lines of the form
formm.Designer.controls(controlName).Picture = LoadPicture("D:\square.bmp")
I'm using the VBA Extensibility library, and
Dim formm As VBComponent
formm = ....VBComponents.Items("UserForm1")
is delcared at the start of the module, followed by
UserForm1.Show vbModeless
before the block of problematic code.
There is nothing wrong with the spelling etc. of the string controlName, nor of the image file path.
I know that it is possible to load images into an already open UserForm with the use of user inputs like clicks and other buttons. My objective is to make the images load WITHOUT user input, on a time loop. Please advise on how to solve this error.