We help IT Professionals succeed at work.

VBA streamwriter error msg

I am running an application that allows for VBA code to accomplish tasks that the application dosn't do.  I need to write and read to a text file.  in vb.net I would use a dim as streamwriter statement but trying it here i get an error of "user-defined type not defined" any suggestions would help, thanks
Comment
Watch Question

Various
CERTIFIED EXPERT
Commented:
have a read through here
http://vbadud.blogspot.com/2007/06/vba-read-text-files-with-leading.html

 
Dim MyString, MyNumber
Open "c:\test.txt" For Input As #1 ' Open file for input.
Do While Not EOF(1) ' Loop until end of file.
Input #1, MyString, MyNumber ' Read data into two variables.
Debug.Print MyString, MyNumber ' Print data to the Immediate window.
Loop
Close #1 ' Close file.

Open in new window

Author

Commented:
Didn't show how to write but found answer with help of information provided, thanks.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.