lundi 23 juin 2014

Microsoft Excel VBA automatically click OK in a UserForm


Vote count:

0




Hi I'm trying to modify the XmlTools.xla plugin.


I have it set up so that the UserForm already displays with everything my users need prefilled. I just need some way to programmatically click the OK button. I tried using send keys in the code snippet shown below but it does not work.



Public Sub sbShowForm()
Application.DisplayAlerts = False

ActiveSheet.Name = "Sheet555"

ActiveSheet.Cells(Rows.Count, 7).End(xlUp).Select
ActiveCell.Name = "lastCell"

frmCreateXmlList.Show

Application.SendKeys ("{Enter}")
Application.SendKeys ("{Return}")

CreateXmlFiles.sbUserFormOKClicked

Application.DisplayAlerts = True
End Sub 'sbShowForm


I realize this request is a little goofy, but I received user requests saying that it is "too much work" to fill out the form. I know SendKeys aren't always reliable, but I'm just looking for something to get it to work.



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire