Is it Application.ScreenUpdating or Something Else ?

Farah

Board Regular
Joined
Oct 4, 2005
Messages
98
Hello,

I have a code, which send keys for Alt+F11, while it is doing so, it shows the Alt+F11 Screen. I do not want it to be shown, what exactly can i do to keep it on the Excel sheet and take the actions.

Regards,
Farah
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi Farah,

Place ...
Application.ScreenUpdating = False
... at the Beginning of the Code, and ...
Application.ScreenUpdating = True
... Before the End Sub.

Hope this Helps.
All the Best.
SHADO
 
Upvote 0
SHADO has already given you one option, but since you were already considering ScreenUpdating, wouldn't it have been quicker for you to try it rather than ask about it and wait until somone responds?

Farah said:
Hello,

I have a code, which send keys for Alt+F11, while it is doing so, it shows the Alt+F11 Screen. I do not want it to be shown, what exactly can i do to keep it on the Excel sheet and take the actions.

Regards,
Farah
 
Upvote 0
Hello tushar,

i tried ScreenUpdating = False in the beginning of the code and Screenupdating = True before the End Sub, it still go to Alt+F11 Screen and i think, it is due to a line, 'DoEvents' maybe :wink: , or due to something else. :huh:

I even tried, Application.EnableEvents = False & True etc. didn't work as well.

Thank you for your help.

Warm Regards,
Farah
 
Upvote 0
Can you post your code?

It might be easier if everyone saw what you were trying to do.

By its nature, ALT+F11 is going to open the VBE, but that's not necessarily necessary to interact with it. Check Chip Pearson's site for Programming to the VBE for some leads.

Hope that helps,

Smitty
 
Upvote 0
Hi,

Here is the code:

Code:
 Sub Farah()
Application.ScreenUpdating = False

' OPEN VB EDITOR
        Application.SendKeys "%{F11}", True
        
       Application.Wait Now + TimeValue("00:00:01")
        ' TOOLS
        Application.SendKeys "%T", True
Application.Wait Now + TimeValue("00:00:01")
        ' PROJECT PROPERTIES
        Application.SendKeys "E", True
Application.Wait Now + TimeValue("00:00:01")
        Application.SendKeys "fa22(+-)74ed"
Application.Wait Now + TimeValue("00:00:01")
        
        Application.SendKeys "~", True ' ENTER
Application.Wait Now + TimeValue("00:00:01")
       Application.SendKeys "~", True         ' ENTER
       Application.Wait Now + TimeValue("00:00:01")
        ' CLOSE THE EDITOR.
        Application.SendKeys "%FC"
        DoEvents
   
Set VBComps = ActiveWorkbook.VBProject.VBComponents
Application.Wait Now + TimeValue("00:00:01")
For Each VBComp In VBComps
Application.Wait Now + TimeValue("00:00:01")
   Select Case VBComp.Type
      Case vbext_ct_StdModule, vbext_ct_MSForm, _
            vbext_ct_ClassModule
         VBComps.Remove VBComp
      Case Else
      DoEvents
         With VBComp.CodeModule
            .DeleteLines 1, .CountOfLines
         End With
   End Select
Next VBComp
DoEvents
Application.ScreenUpdating = True

End Sub
 
Upvote 0
I am not 100% certain, but I think the send keys will cause automatically turn screenupdating back on.
 
Upvote 0
Farah

Are you using this code to open a protected project and then delete all the code in it?

If you are I would say this is not a very good way to be going about things.

Why do you want to delete the code in the first place?
 
Upvote 0
If you do indeed want to add/delete code in the VBE (by way of code) you should have a look at Chip Pearson's contributions here.

Hope that helps!

P.S. Please read the page carefully, to save yourself a lot of potential grief...

NOTE: In all versions of Excel, the VBProject must not be protected. If it is, these procedures will fail. In Excel 2002, you must have "Trust Access To Visual Basic Project" enabled. To enable this setting, go to the Tools menu in Excel, choose Macros, Security, then the "Trusted Sources" tab, and put a check next to "Trust Access To Visual Basic Project". Otherwise, you will get errors.
 
Upvote 0

Forum statistics

Threads
1,225,072
Messages
6,182,695
Members
453,132
Latest member
nsnodgrass73

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