I do have a weird issue here, looking for someone with an elegant solution. I use something like
With destCell.Parent.QueryTables.Add(Connection:="TEXT;" & exportUrl, Destination:=destCell)
'all these have sane defaults, yes, but if the user used text to columns with something, this changes magically. So stupid
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileDecimalSeparator = "."
.TextFileThousandsSeparator = False
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileCommaDelimiter = True
.TextFileTabDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileConsecutiveDelimiter = False
' there is no way to set this to nothing, apparently.
.TextFileOtherDelimiter = ","
.TextFilePlatform = 65001 'UTF-8
.Refresh BackgroundQuery:=False
End With
To fetch data from a php web application. I'm having access keys in the URL as query parameters. If they are correct, all goes fine. If they are wrong, the php returns a http 403 page. This makes Excel raise error 1004, which I catch, all good. Now, any subsequent call to the code, with changed (and now correct) access keys stil raises 1004. Excel doesn't even fire up a http request any more according to server logs. Looks like it is caching the http response code.
As the user has to enter the keys, it can easily happen that they are wrong. I'd like to offer to enter correct ones, but than the above will make them look still wrong...
Ideas welcome! Running Excel 2016 if that makes a difference.