I am creating two different userforms to amend data on a spreadsheet. Since they will be pre-populated with information on the spreadsheet, I need to initialize them before display. I was told that the initializing subs should be private. But the macro is not reading them, so I change them to public. Now, one userform is behaving fine, but the second one is still not loading. It keeps on giving the following message:
Run-time error '-2147024809 (80070057)': Could not find the specified object.
What is the error? Also, why can't I use private initializing subs like every one else? Better yet, what is a good way in managing the various userforms? Thanks!
Update after Rory's comment : There are the codes in the main module
Sub AddLog()
AddLogForm.UserForm_Initialize
AddLogForm.Show
Unload AddLogForm
End Sub
Sub AmendHeader()
AmendForm.UserForm_Initialize
AmendForm.Show
Unload AmendForm
End Sub
It appears that error was inside the userform sub, but I did not see it because my error trapping was not set to break inside the class module. Nonetheless, I'm still having trouble with the private/public distinction. Perhaps this snippet helps?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.