Text File Query - Provider Error

erock24

Well-known Member
Joined
Oct 26, 2006
Messages
1,160
I just changed to windows 7 and excel 2010. Now my excel macro code errors out saying provider not found, may not be properly installed. This is the function where the error occurs, do anyone know how to update the code to work with my new version of windows and excel.

Code:
Private Function GetCNN(ByVal csvPath As String) As ADODB.Connection
    Set GetCNN = New ADODB.Connection
    With GetCNN
        .CommandTimeout = 0
        .ConnectionTimeout = 0
        .Provider = "Microsoft.Jet.OLEDB.4.0"
        .ConnectionString = "Data Source = " & csvPath & ";" & _
                            "Extended Properties = ""text;HDR=Yes;FMT=Delimited(,)"""
        .Open
    End With
End Function
 

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

erock24

Well-known Member
Joined
Oct 26, 2006
Messages
1,160
i get the same error message, "Provider cannot be found, it may not be properly installed. "
Error 3706.... Do i need to install something??
 

erock24

Well-known Member
Joined
Oct 26, 2006
Messages
1,160
Thanks for the link, I actually found what I needed from reading some fine print attached to a microsoft link within the thread. All i needed to do was change what you originally suggested to:

Rich (BB code):
.Provider="Microsoft.Ace.OLEDB.12.0"

thanks,
 

Ruddles

Well-known Member
Joined
Aug 24, 2010
Messages
5,785
D'oh! I thought .12 for Excel 2007, .14 for Excel 2010.
 

Watch MrExcel Video

Forum statistics

Threads
1,108,924
Messages
5,525,665
Members
409,658
Latest member
Yardcell

This Week's Hot Topics

Top