I have big number of defined buttons and they are used to open PDF files, some have valid paths and others doesn't. I need to get the path of the button and check first if the path is valid the button is executed otherwise a message box will show that the document does not exists. I managed to do this but what I need is to have an automatic way in getting the path of the button instead of copying it from the button for each one of them.
So when a command button is pressed the code below is executed:
Private Sub CommandButton1_Click()
Path1 = "W:\F1\TEP\FO\PRD\Document1.pdf"
If Dir(Path1) = "" Then
MsgBox ("Sorry! Document is not available currently")
The part in bold is what I only need to automate. Any thoughts or suggestions?
Thanks in advance,