Wednesday, July 10, 2019

Excel Vba function stops working on reopen

I was trying to set a vba function that changes the color of a hyperlink when it links to a non existing file. For that, I got the following code on a standard module.


Function FileExist(path As String) As Boolean
If Dir(path) <> vbNullString Then FileExist = True
End Function

Then I used said function as a conditional formatting for the cells I wanted and it worked as intended.I then saved the file as a macro enabled workbook and closed the program.


When i reopened it, it stopped working. the function was returning false for every imput. The only way i got it to work again was by going to "save as" and saving it again as macro enabled and then refreshing the whole thing .


I verified the trust center and even set to "enable all macros", still it would not work after i reopened the file unless I did the procedure mentioned before.


I have no idea what could be the problem, so i'd appreciate any help.
Thanks in advance.

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...