• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 164
  • 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

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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