Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA - Own Type Question

Status
Not open for further replies.

Bretthawk

Technical User
May 25, 2010
1
ZA
Hi everyone,
Need your assistance please.
I'm maintaining a piece of VBA (Excel) and can't seem to compile - Compilation fails on this statement:

Dim tf As New TextFile
tf.Filename = Left(dnFile, Len(dnFile) - 4) + ".out"
tf.openToWrite

My question is this: Where is 'Textfile" defined? Is that a user-defined type?

Thanks
Brett
 
If your question is dealing with VBA code, you need to ask in the appropriate forum:
forum707

In the mean time, I think you need to look at various ways of dealing with text files from VBA. Try this search, and try the below link as a starter:

And best I can remember, best I can find, yes, "TextFile" must be some user-defined type. If it is not, then your simply missing a reference in your VB Editor. To select the correct one, go to Tools - References, and find the one related. If you don't know what it is, I'd look for anything to do with text. You could use the Object Browser to search for it, View - Object Browser.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top