Solved

Read A File

Posted on 2002-07-15
5
155 Views
Last Modified: 2010-05-02
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
Comment
Question by:mtbuford
5 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 7154358
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
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7154386
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
 
LVL 6

Expert Comment

by:ebosscher
ID: 7154440
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
 
LVL 43

Expert Comment

by:TimCottee
ID: 7535977
Why a 'C' grade? A comment would have been nice!
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7536958
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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA error replacing data 6 40
MS Acccess - Update Field in Table when report is printed 6 45
Sending a email via excel using vba 6 82
Zip Folders Using Chilkat Routines 1 41
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question