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

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
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,885
Messages
6,122,090
Members
449,065
Latest member
Danger_SF

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