VBA check if a new workbook is created

Wicked_

Board Regular
Joined
Jun 5, 2018
Messages
81
Hi.

Got a question.
Is there a way to create a VBA code, that constantly checks a specific folder, if a new workbook is created?
For it to be easy to understand, lets pretende workbook1 is called 1.xlsm (which im using), then if i create a book called 2.xlsm inside that same folder, i want to code to recognize it, and launch a specific userform inside book 1.

Is this possible ?

Thanks.
 
Not sure, I used this as a test.

Code:
Sub Testfile()
If FileExists("C:\Temp\TestBook2.txt") Then
    MsgBox "Found"
Else
    MsgBox "Nope"
End If
End Sub

Testet the same.
Got Nope when i had the correct name, and found when it when i had a wrong name (the name of the file itself)
 
Upvote 0

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.
Ah, I stopped using the CFF_Found and just used FileExists("C:\Temp\TestBook2.txt") which answers true if found
 
Upvote 0

Forum statistics

Threads
1,216,360
Messages
6,130,175
Members
449,562
Latest member
mthrasher16

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