Excel and VBA Editor

I have an Excel file open. I am sending hot key alt+f8 to open VBA editor, input some VBA code. Now in VBA editor I do “CTRL + Home” to get to the top line of the code. To execute I do the F5.

Now the VBA is executed. I need to close VBA editor window and Save Excel file. How can I do this with hot keys? Please help.

Thank you,

Hi @A_Learner ,

Try using alt+f4 inside editor to close the editor
Once closed try ctrl + s to save the excel.

Personally instead of this approach, you can execute the code one the using execute macro or invoke vba.

That would be more easy and efficient.

Hope it works out for you.



I am using attach window for the VBA editor.
Inside it CTRL+Home
Alt + f4

But Alt + f4 not closing the window.

So CTRL + s not finding Excel window.

Thank you,

@A_Learner ,

Working very smoothly for me.

Refer the attached work flow.
ForumQuestion.zip (9.1 KB)

Note : Open your macro , VBA Editor window and execute the attached workflow. If it works for you then tune your workflow just like the attached one.

Hope this helps you out.!


1 Like

So one more question is this is in Use Application Excel file scope. So can I still attach Excel window within this scope?

Use Application Input.xlsx
Attach VBA editor window
Attach Excel window

Thank you.

I couldn’t see why not.

Thank you, @Gautham_Pattabiraman will try.

1 Like

If you find my response helpful please mark that as a solution.

Not working. My file is .xlsx, not .xlsm
And I am doing attach window in use application.

Thank you,

Hi @A_Learner ,

modified the selector a little now it should work on xlsx.

Wrkflow :
ExcelForumQuestion.zip (9.0 KB)
Flow in Action :

Let me know if this workout for you.


Hey @A_Learner , was just wondering… any specific reason why the code needs to be invoked from the VBA Editor?

You can save it into a text file, and then invoke it directly from the Invoke VB Script activity (Doc: Activities - Invoke VBScript)

Might be way easier and less risky as you don’t depend on the interface to appear :slight_smile:

“Invoke VBA” not allowed.

Thank you.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.