troubleshooting Question

Access VBA User type not User-defined type not defined

Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft AccessVBA
8 Comments3 Solutions19 ViewsLast Modified:
Hi

I get the error "User-defined type not defined" in the first line of the following code

Sub DisplayTextFile()   
     Dim fso As New FileSystemObject    
     Dim t As TextStream    
     Dim strFilePath As String    
     Dim strBuffer As String   
     strFilePath = "C:\test.txt"   
     If fso.FileExists(strFilePath) Then        
         Set t = fso.OpenTextFile(strFilePath,          ForReading, False)       
         strBuffer = t.ReadAll        
         MsgBox strBuffer        
         t.Close    
     End If   
    Set t = Nothing 
End Sub
SOLUTION
Join our community to see this answer!
Unlock 3 Answers and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros