完了

Moving given line in a txt file to new fixed line in same file.

Hi all

I have a small project, that includes reading ASCII txt files with invoice information, the files contain all the information needed, but its NOT consequent on each side. The file is used after reading as an input to a access code who then generates the invoices thru a report generator.

When I have inconsequent output from the txt files the generator will not print correct information on each page,(the pagebreak in the generator failes regards to fixed pagebreak)and the information printed is rubbish.

I need a code to search for a given word or caracter and then put that line to a fixed line, and push all the txt below this line down including the search txt.

## Deliverables

Here is the code that i am using.

Function Prep() As Integer

Dim lngInFile As Long

Dim lngOutFile As Long

Dim strIn As String

Dim strOut As String

Dim lngCounter As Long

Dim intPos As Integer

Dim strReplace As String

Dim dooloop As Long

Dim PageBreak As Boolean 'True/False variable to tell if its the

Dim GoToLine As Integer

Dim LineCount As Integer 'Counter for current line number

lngInFile = FreeFile

Open "D:\ERGO\FA\BIN\[url removed, login to view]" For Input As lngInFile

lngOutFile = FreeFile

Open "D:\ERGO\FA\BIN\[url removed, login to view]" For Output As lngOutFile

While Not EOF(lngInFile)

Line Input #lngInFile, strIn

intPos = InStr(strIn, " LISTE")

While intPos > 0

lngCounter = lngCounter + 1

strReplace = (" LISTE2") & vbCrLf

'do something...

strIn = Replace(strIn, " LISTE1", strReplace, , 1)

intPos = InStr(strIn, " LISTE1")

Wend

intPos = InStr(strIn, "Totalt ")

While intPos > 0

lngCounter = lngCounter + 1

strReplace = "Totalt: "

'do something...

strIn = Replace(strIn, "Totalt ", strReplace, , 1)

intPos = InStr(strIn, "Totalt ")

strIn = vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & _

vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & _

vbCrLf & vbCrLf & vbCrLf & vbCrLf & strIn

Wend

intPos = InStr(strIn, "Side: 2")

While intPos > 0

lngCounter = lngCounter + 1

strReplace = "Side : 2"

'do something...

strIn = Replace(strIn, "Side: 2", strReplace, , 1)

intPos = InStr(strIn, "Side: 2")

strIn = vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & _

vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & _

vbCrLf & vbCrLf & vbCrLf & vbCrLf & strIn

Wend

intPos = InStr(strIn, " ----------------")

While intPos > 0

lngCounter = lngCounter + 1

strReplace = " "

'do something...

strIn = Replace(strIn, " ----------------", strReplace, , 1)

intPos = InStr(strIn, " ----------------")

Wend

intPos = InStr(strIn, " 8398 10 03791")

While intPos > 0

lngCounter = lngCounter + 1

strReplace = (" 8398 10 03791") & vbCrLf & (Chr(12))

'do something...

strIn = Replace(strIn, " 8398 10 03791", strReplace, , 1)

intPos = InStr(strIn, " 8398 10 03791")

Wend

intPos = InStr(strIn, "?")

While intPos > 0

lngCounter = lngCounter + 1

strReplace = "?"

'do something...

strIn = Replace(strIn, "?", strReplace, , 1)

intPos = InStr(strIn, "?")

Wend

intPos = InStr(strIn, "?")

While intPos > 0

lngCounter = lngCounter + 1

strReplace = "?"

'do something...

strIn = Replace(strIn, "?", strReplace, , 1)

intPos = InStr(strIn, "?")

Wend

intPos = InStr(strIn, "›")

While intPos > 0

lngCounter = lngCounter + 1

strReplace = "?"

'do something...

strIn = Replace(strIn, "›", strReplace, , 1)

intPos = InStr(strIn, "›")

Wend

intPos = InStr(strIn, "†")

While intPos > 0

lngCounter = lngCounte

## Platform

Windows 2000, Access2000, VB6

スキル: .NET, エンジニアリング, マイクロソフトアクセス, MySQL, PHP, ソフトウェアアーキテクチャ, ソフトウェアテスト, ビジュアルベーシック

さらに表示: prep for prep, new line in php, in this line, integer word search, c# report generator, code line, boolean search string generator, moving from, boolean search string, txt, prep, on line d, Instr, fa, eof, d caracter, chr, open input file php, php open input file, open input file

採用者について:
( レビュー1件 ) Norway

プロジェクトID: #2883364

アワード:

csdvw

See private message.

$21.25 USD 14日以内
(10レビュー)
2.6

4人のフリーランサーが、このジョブに平均$34で入札しています

softservicesvw

See private message.

$12.75 USD 14日以内
(335件のレビュー)
7.7
pvavw

See private message.

$17 USD 14日以内
(39件のレビュー)
3.9
pepitovw

See private message.

$85 USD 14日以内
(レビュー1件)
2.6