• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Opening a workbook

sn152

Member
Hi All,

I have a macro which will open a workbook according to the path mentioned in sheet1 range C5.

But when the file name specified in the sheet 1 range C5 is not available in the path mentioned in sheet1, it is giving an error.

Can we fix this by stopping the macro, if the file name specified in the sheet 1 is not available in the path and close the macro file.

Please help me with this. Attached the file for your reference.


Thanks in advance!
 

Attachments

  • Sample.xlsm
    12.8 KB · Views: 2
Hi Asheesh,

Thank you for your help. But this is not what i was looking for. Your code shows a msg when the file path and name is not mentioned in sheet1. But what I want is the file path and name will be there in sheet 1 and if the specified file name is not there in the path then the macro should stop and workbook should close.
 
ie., the macro should check the specified path and if the file is not there in the path, then it should close.
 
@sn152 .. check the attached...If i understood right...this is what you are looking for...
 

Attachments

  • Sample Code.xlsm
    12.4 KB · Views: 2
Back
Top