vbalearner11
New Member
- Joined
- Jan 19, 2018
- Messages
- 18
Hello All,
I have a code which is working fine for couple of files but crashing when trying to open a particular file.
Workbooks.Open (UserFolder & Left(FileObj.Name, InStrRev(FileObj.Name, ".") - 1) & ".xlsm")
Workbooks.Open (UserFolder & Left(FileObj.Name, InStrRev(FileObj.Name, ".") - 1) & ".xlsb")
UserFolder & Left(FileObj.Name, InStrRev(FileObj.Name, ".") - 1) this has the folder path without extensions such as ".xlsm" or ".xlsb". Sometimes the extension might be either of them so I cannot just give one line of code.
Looking for help.
Thanks in Advance!
I have a code which is working fine for couple of files but crashing when trying to open a particular file.
Workbooks.Open (UserFolder & Left(FileObj.Name, InStrRev(FileObj.Name, ".") - 1) & ".xlsm")
Workbooks.Open (UserFolder & Left(FileObj.Name, InStrRev(FileObj.Name, ".") - 1) & ".xlsb")
UserFolder & Left(FileObj.Name, InStrRev(FileObj.Name, ".") - 1) this has the folder path without extensions such as ".xlsm" or ".xlsb". Sometimes the extension might be either of them so I cannot just give one line of code.
Looking for help.
Thanks in Advance!