VBA code to enter data in a userform created by another macro

Phil_T123

New Member
Joined
Jan 4, 2019
Messages
7
Hi,

So, the problem I'm having is that some code I am writing calls another macro. This second macro has a userform with fields that must be completed before it will continue.

Is there any way I can have code in the first macro that will enter data into the userform from the second?

The main problem here is that I don't have access to the code in the second macro. As far as I understand, this means:

(1) I can't bypass the form and pass the variables directly to the second macro's code as I can't edit the second macro.
(2) I can't call an event when the userform activates as that code would need to be in the second macro and I can only edit the first, which pauses once the second macro is called.
(3) I can't use an application event as there isn't one that covers a userform popping up.


Any ideas?

Thanks in advance!


Phil.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Phil

Do you have any access to the userform or it's code?
 
Upvote 0
Phil

I was going to suggest you could try accessing the form via the UserForms collection but if the project is password protected I'm pretty sure that's not going to be possible.

The only other way I can think of would be to use the Windows API and treat the form as a 3rd party application.
 
Upvote 0
Hi Norrie,

That isn't something I had considered, so I will look into this and have a play around, when I get a chance.


Thanks for your help!

Phil.
 
Upvote 0

Forum statistics

Threads
1,215,614
Messages
6,125,848
Members
449,266
Latest member
davinroach

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top