Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following macro that works perfect for opening
a txt file. Workbooks.OpenText Filename:= _ "C:\Path\Report200407JC.txt" _ , Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:= _ Array(Array(0, 1), Array(5, 1), Array(10, 1), Array(15, 1), Array(20, 1), Array(25, 1)) What I want to do is change the month in the name each month. So I am using; Dim Mth As String Mth = "" & Format(DateSerial(Year(Date), Month(Date) - 1, 1), "yyyymm") Workbooks.OpenText Filename:= _ "C:\Path\Report & "Mth" & JC.txt" _ , Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:= _ Array(Array(0, 1), Array(5, 1), Array(10, 1), Array(15, 1), Array(20, 1), Array(25, 1)) I would like "Mth" to generate 200407 in Aug so the file name generated would be Report200407JC.txt But this always gives me a syntax error. Any ideas where the error is |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error dialog box meaning and how to find error | Excel Worksheet Functions | |||
I cannot find an error in excel | Excel Discussion (Misc queries) | |||
how to find an error | Excel Discussion (Misc queries) | |||
help with this error-Compile error: cant find project or library | Excel Discussion (Misc queries) | |||
Can' t do a 3d graph in Office XP for Students | Charts and Charting in Excel |