Home » Questions » Computers [ Ask a new question ]

Why does my regular expressions invoke error '5018' in my VBA script in Excel

Why does my regular expressions invoke error '5018' in my VBA script in Excel

I just wrote my first VBA script for Excel because I have to write many "*.txt" files from a folder into an excel spreadsheet. But when I run this script, I get the error '5018'. It is invoked by the line

Asked by: Guest | Views: 296
Total answers/comments: 1
Guest [Entry]

"Just fixed it. Apparently my regular expression is wrong. 5018 stands for ""Unexpected quantifier in regular expression"". So I changed it to

reg.Pattern = ""^.+\.txt$"""