Running a VBA code when computer starts

teranprasanna
Lounger
Posts: 27
Joined: 24 Jun 2020, 01:39

Running a VBA code when computer starts

Post by teranprasanna »

I need to run one VBA code automatically once computer starts without any manual intervention.

Can you please assist me,

Thank you.

User avatar
HansV
Administrator
Posts: 78445
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Running a VBA code when computer starts

Post by HansV »

Try the following:

Create an Excel workbook.
Create a macro that you want to be run automatically.
Create the following code in the ThisWorkbook module of this workbook:

Code: Select all

Private Sub Workbook_Open()
    Call MyMacro
End Sub
where MyMacro is the name of the macro that you created.
Save the workbook as a macro-enabled workbook (*.xlsm) in your Startup folder

C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

where <username> is your Windows logon name.
Best wishes,
Hans

teranprasanna
Lounger
Posts: 27
Joined: 24 Jun 2020, 01:39

Re: Running a VBA code when computer starts

Post by teranprasanna »

Thanks a lot, Hans