Share via

Excel VBA Last Modified Date returns #VALUE Error

Anonymous
2017-10-04T23:03:26+00:00

Hi,

I am doing an assignment for school that requires me to display the last modified date on an excel file. Honestly, this is the first time I am using VBA with Excel and don't know much. Below is the code my teacher provided me and it seems right according to all the forums online.

Public Function ModDate()

    Application.Volatile

    ModDate = Format(FileDateTime(ThisWorkbook.FullName), "m/d/yy h:n ampm")

End Function

Every time I try to run the code within the VBA window it returns the error: Invalid procedure call or argument and points to the third line of code. Has anyone experienced this issue and is there a fix to this?

Thank you,

Sarah Tse

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2017-10-04T23:41:48+00:00

So I found that saving the Excel file to One Drive is what causes this error so I just saved it locally on my PC.

Was this answer helpful?

6 people found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful