Hi.
So i got a userform in one of my folders, and i want it so, that everytime i start up the excel program, it imports that form, then run the code inside the form as normal.
So far i got this:
In ThisWorkbook i got:
Private Sub Workbook_Open()
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
Application.VBE.ActiveVBProject.VBComponents.Import "O:\Mask9\Dash\Main.frm"
And in the Main.frm i got any "random" code that it does, but that shouldent matter here (as far as i know)
But when i run this program i get this error: Run-time error '424': Object required.
I even tried adding Application.Wait (Now + TimeValue("0:00:02")) in the ThisWorkbook, to "force it" to import, before the Main.frm run its code., but i still got the error the second i opened it.
When i press end (debug is greyed out), i see that the main.frm is loaded, but it seems like it wont run the code after it as been imported.
Is there a way to fix this issue?
Thanks
So i got a userform in one of my folders, and i want it so, that everytime i start up the excel program, it imports that form, then run the code inside the form as normal.
So far i got this:
In ThisWorkbook i got:
Private Sub Workbook_Open()
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
Application.VBE.ActiveVBProject.VBComponents.Import "O:\Mask9\Dash\Main.frm"
And in the Main.frm i got any "random" code that it does, but that shouldent matter here (as far as i know)
But when i run this program i get this error: Run-time error '424': Object required.
I even tried adding Application.Wait (Now + TimeValue("0:00:02")) in the ThisWorkbook, to "force it" to import, before the Main.frm run its code., but i still got the error the second i opened it.
When i press end (debug is greyed out), i see that the main.frm is loaded, but it seems like it wont run the code after it as been imported.
Is there a way to fix this issue?
Thanks