Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

Read A File

I want to open a file called Monthend and read the first line, get that data and put it as the name of an output file with the .zip extension on it.  Can anyone help.
0
mtbuford
Asked:
mtbuford
1 Solution
 
TimCotteeCommented:
Dim intFHandle As Long
Dim strData As String
intFHandle = FreeFile()
Open "monthend" For Input As #intFHandle
Line Input #intFHandle,strData
Close #intFHandle
Msgbox strData & ".zip"
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
dim strLine as string

open "monthend" for input as #1
line input #1, strLine
close #1

strLine = strLine & ".zip"
open strLine for output as #1
...
close #1

CHeers
0
 
ebosscherCommented:
TimCottees answer is more complete, as using freefile will prevent you from running into conflicts with the file number (1) being in use by another application.

Cheers
0
 
TimCotteeCommented:
Why a 'C' grade? A comment would have been nice!
0
 
MindphaserCommented:
Changed grade per request.

mtbuford

If you didn't get enough information feel free to ask the experts any further questions. Take a look at http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp to read more about grading.

** Mindphaser - Community Support Moderator **
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now