-
March 13th, 2012, 07:04 AM
#1
Comm Automation MS Excel
Hi All,
I am currently undertaking a small project to reformat fixed with data into ms excel.
I am currently able to read a text file to the end and output a string of data into an array, and thereafter insert this data logically into a column with ms excel.
I am having an issue when recreating this onto columns using different substring, each record read is skipped by one?
How can i also do this more effectively as i have like 30 other files with +/- 70 substring instances that i need to segment out in ms excel.
See below code :
Do While objSFR.Peek <> -1
writestring = objSFR.ReadLine.Substring(0, 17)
cellno = cellno + 1
cellnm = "A"
cellnm = cellnm + cellno.ToString()
cellnm = cellnm.Replace(" ", "").ToString().Trim()
oSheet.Range(cellnm.ToString().Trim()).Value = writestring
writestringb = objSFR.ReadLine.Substring(18, 3)
cellnob = cellnob + 1
cellnm1 = "B"
cellnm1 = cellnm1 + cellnob.ToString()
cellnm1 = cellnm1.Replace(" ", "").ToString().Trim()
oSheet.Range(cellnm1.ToString().Trim()).Value = writestringb
Loop
Let me know if you need me to paste the full code, the above is just logic i am try to use to segment each column based on substring value.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|