Wednesday, November 24, 2010

How can I account for a file name change in VBA?

I have a workbook that has a certain name and have programmed all it's inner workings with that name in mind. Is there a way that I can set a variable to equal the current file name then use the variable in place of the actual workbook name throughout the code?



If you need more information let me know.



I was thinking something like: wbname = workbook.entirename



but that doesn't work.How can I account for a file name change in VBA?Try using this:



name = Application.ActiveWorkbook.FullName





Hope that helps.

No comments:

Post a Comment