SendKeys from a UserForm commandbutton

keith

Board Regular
Joined
Mar 3, 2002
Messages
88
If I use:

SendKeys ("%fdm")

from a standard macro it works fine. However if I try to use the exact same code from a button on a Userform I see the file menu flash real quick but nothing happens. I even tried having the commandbutton on the userform call the macro and it won't work.

If I put a form button on the sheet directly and assign the macro to it, it works. But if I try it from a Userform it just will not work?

This one has me pulling my hair out..

advance thanks
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I figured it out myself!!

The menu item I was trying to call in Excel required a cell to be activated or the menu option was greyed out. So I had to change the code to:

UserForm1.Hide
Range("A1").Select
SendKeys ("%fdm")

Geez I HATE stuff like that..

thanks anyway..
 
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,317
Members
448,564
Latest member
ED38

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