How to run VBA event only once in a day?

Mdarshadali2609

New Member
Joined
May 9, 2021
Messages
1
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
I recorded a script to a macro file and called that specific macro using a VBA project (personal.xlsb). Every time any Excel is open (Workbook_open).

But now I only want to restrict that call to once a day. For example if the individual macro calls that specific macro once a day, then the event is postponed to the next day and the macro is not called upon opening any Excel file.

Please tell me how I can ban my event performing only once a day, and the next event should take place the next day.

Thank you
Code:
Sub run()


Application.run "'C:\Users\850051636\OneDrive - Genpact\Desktop\Working\Project 5 WIP Stock Transfer\Working QPA_Stock Transfer_Draft_v1.0.xlsm'!Module1.test"

End Sub
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Welcome to MrExcel Message Board.
Change Cell A1 if you have data on it.
You Can Try this:
VBA Code:
Sub run()
If Range("A1").Value = Date then exit sub 
Application.run "'C:\Users\850051636\OneDrive - Genpact\Desktop\Working\Project 5 WIP Stock Transfer\Working QPA_Stock Transfer_Draft_v1.0.xlsm'!Module1.test"
Range("A1").Value = date
End Sub
Also you can use workbook open event I think.
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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