Fill Input Box called by another macro

MarkElla

New Member
Joined
Mar 5, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi, I have written a macro which calls another macro (called 'Step1'). Unfortunately, 'Step1' is locked by my company so I cannot review or edit it. When 'Step1' is called, it requires a string to be entered into an input box. Is there any way I can send a string from my macro to fill this input box? Thanks
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
hi and welcome to MrExcel
if the inputbox is a userform with a textbox, and you know the name of the textbox then it is possible. if it is indeed an inputbox then that is launched within the locked code and you cannot access it without using sendkeys which is dodgy and unreliable (and may not work anyway if a different subroutine is running)
 
Upvote 0
Thanks for your reply. When the input box appears, I already have the required data copied to the clipboard. So I can manually use CTRL+V to paste the string then click OK, and the macro 'Step1' continues. But I was hoping to automate the Paste and OK.
 
Upvote 0
yeh. i think the problem is going to be that the Step1 macro is running so your macro no longer has control so it cant send anything to automate the process. my thought was to inject the textbox in Step1, but that only works if it is a userform with a textbox as the input. i think you are stuck unfortunately
 
Upvote 0
ok, thanks. 'Step1' is part of a company-wide spreadsheet, so I won't be able to change it. However, if I can get access to the macro code, does this help me?
 
Upvote 0
possibly. can you post the code
 
Upvote 0
sorry for the delay, as it took a while to get access to the code. The start of 'Step1' is as follows:

Sub Step1()
Project = InputBox("Enter Project", , "123.12345.00000")
If Len(Project) <> 15 Then
MsgBox "Wrong Job Number Format", vbCritical
End
End If
...
...


I would like to send a 15-character string directly to the InputBox.
 
Upvote 0
if you cant edit Step1 then because of the way it is set up, you will not be able to do what you wanted. :(
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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