Hello all, Hoping to find some assistance with a pesky task. Each week, I run a report that produced a text file. This task is going to be handed off to other individuals with limited Excel experience and need to automate as much as possible. I have been successful in prompting the user to open the file, but really running into issues with the actual import There are 17 columns with varying widths. I cannot seem to get this to work correctly.
The columns start at 1, 6, 8, 10, 18 (these are text) 32 (MDY) 41, 50 (General) 62, 71 (MDY) 80 (YMD) 87, 91, 93, 96 (Text), 100 (MDY) 109 (General).
Google found the below, which in theory would seem perfect, lets me enter the character where the break occurs along with the format, but I cannot get it to run without getting a Compile Error: Syntax error at the file location
Any assistance would be most appreciated!!
The columns start at 1, 6, 8, 10, 18 (these are text) 32 (MDY) 41, 50 (General) 62, 71 (MDY) 80 (YMD) 87, 91, 93, 96 (Text), 100 (MDY) 109 (General).
Google found the below, which in theory would seem perfect, lets me enter the character where the break occurs along with the format, but I cannot get it to run without getting a Compile Error: Syntax error at the file location
VBA Code:
Const xlFixedWidth = 2
Set objExcel = CreateObject(“Excel.Application”)
objExcel.Visible = True
objExcel.Workbooks.OpenText _
“C:\Scripts\Test.txt”,,,xlFixedWidth,,,,,,,,,Array(Array(0,1),Array(14,1),Array(32,1)))
Any assistance would be most appreciated!!