Login | |
|
 |
RE: convert txt to xls - 8/1/2005 9:27:56 PM
|
|
 |
|
| |
ehvbs
Posts: 2078
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
|
Hi hahapat, I had problems to construct a valid input file from your posting. Therefore the following remedy may fail. If so, can you send me a sample file via email? But first let's try this. Our strategy to get at the columns by RegExp "\S+" (sequence of non-spaces) fails for column names like "Built-in account for administering the computer/domain". I'd have prefered to keep all information about the input files from our magic, but that seems to be impossible. So edit doOurMagic(): Dim nIdx Dim aFNamRpl aFNamRpl = Array( "Built-in account for anonymous access to Internet Information Services" _ , "Built-in_account_for_anonymous_access_to_Internet_Information_Services" _ ) If Right( sTail, 2 ) <> vbCrLf Then sTail = sTail + vbCrLf End If sLine2 = Left( sTail, InStr( sTail, vbCrLf ) - 1 ) For nIdx = 0 To UBound( aFNamRpl ) Step 2 sLine2 = Replace( sLine2, aFNamRpl( nIdx ), aFNamRpl( nIdx +1 ) ) Next Set oRE = New RegExp If I overlooked some not-so-nice column names, you'll have to add them to aFNamRpl. I was afraid, that replace markers > "$9" would pose another problem. It was a nice surprise that VBScript handled "$54" gracefully. But this feature could be version dependend. So be prepared for errors in line sTail = oRE.Replace( sTail, sRpl ) Did you solve the task of processing more than one file?
|
|
| |
|
|
|
|
|