Appreciate your support as i trying to run a code to make file opens only IF opened file certain cell contains specific data in it
for example i need opened file to open only when C2 contains "available" and hence, i could compelete remaining processing for this file but if opened file Cell C2 equals "maintain" then i need to close the opened file and pop up a message you selected the wrong file
i tried the below code but the result was: if the opened file Cell C2 contains maintain as a word the remaining processing is not compelete unlike if the file opened cell c2 contains available but the wrong sheet still open and pop up message is not shown
PArt of the Code related to this issue: 'File to Open Dim FileToOpen As Variant Dim OpenBook As Workbook
FileToOpen = Application.GetOpenFilename(Title:="Browse for your File & Import Range", FileFilter:="Excel Files (*.xls*),*xls*")
If FileToOpen <> False Then
Set OpenBook = Application.Workbooks.Open(FileToOpen)
Set Ssheet = OpenBook.Worksheets("Default")
If (Ssheet.Cells(3, "C") = "Maintain") Then
Ssheet.Close
MsgBox "You have Chose check Maintain File ! please choose Available File"
GoTo ErrHandler
End If
Aucun commentaire:
Enregistrer un commentaire