Cancelar Procedimiento de Importar CSV sino Cumple VBA

Actualmente estoy realizando un proceso de importar un CSV en VBA y al momento todo bien.

Únicamente que me he dado cuenta que en una maquina, no me esta importando la información.

Revisando en Internet me doy cuenta que es por temas que en la configuración regional, el "Separador de lista" esta diferente al que tengo como carácter separador en mi VBA; entonces cuando el usuario genera desde su maquina el CSV, y lo importa a mi VBA no se realiza la importación.

Sub ImportCsvFile(FileName As Variant, Position As Range)
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & FileName _
, Destination:=Position)
.Name = Replace(FileName, ".csv", "")
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlMacintosh
.TextFileStartRow = 2
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileOtherDelimiter = ";"
.Refresh BackgroundQuery:=False
End With

Mi pregunta es: Podrían ayudarme a poner algún mensaje que le indique al usuario que el archivo CSV que esta importando, tiene un delimitador diferente al permitido y detenga el script.

Añade tu respuesta

Haz clic para o