M
Mr. Smith
Nothing ticks me off more than when you copy a complete sub/function
straight out of an office VBA help example and it doesn't work. Grrrrr!!!!
Try this:
******************
Sub SetAndReturnDataSourceName()
Dim appOffice As Office.OfficeDataSourceObject
Set appOffice = Application.OfficeDataSourceObject
With appOffice
.Open bstrConnect:="DRIVER=SQL Server;SERVER=10.15.1.66\Refresh;" & _
"AdlerM=user;PWD=Eagle1234;DATABASE=Refresh",
bstrTable:="Employees"
If .DataSource = "" Then
.DataSource = "Refresh"
MsgBox .DataSource
End If
End With
End Sub
*****************************
I've tried it in PPT, Excel, and Word. They all fail on:
** Set appOffice = Application.OfficeDataSourceObject **
Reporting "Object does not supprt this method or property."
Fine. So what reference do I need to include? Come on MVP's!!
Mr. Smith
straight out of an office VBA help example and it doesn't work. Grrrrr!!!!
Try this:
******************
Sub SetAndReturnDataSourceName()
Dim appOffice As Office.OfficeDataSourceObject
Set appOffice = Application.OfficeDataSourceObject
With appOffice
.Open bstrConnect:="DRIVER=SQL Server;SERVER=10.15.1.66\Refresh;" & _
"AdlerM=user;PWD=Eagle1234;DATABASE=Refresh",
bstrTable:="Employees"
If .DataSource = "" Then
.DataSource = "Refresh"
MsgBox .DataSource
End If
End With
End Sub
*****************************
I've tried it in PPT, Excel, and Word. They all fail on:
** Set appOffice = Application.OfficeDataSourceObject **
Reporting "Object does not supprt this method or property."
Fine. So what reference do I need to include? Come on MVP's!!
Mr. Smith