Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / June 2006

Tip: Looking for answers? Try searching our database.

Embedding data from a SQL server

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mr. Smith - 06 Jun 2006 02:27 GMT
Hi All,

I'm quite familar with working with data from various databases in Office
apps but never Powerpoint.  I tried the following code to test the workings
of using SQL data in a PP pres but it fails.  Can anyone tell me why? Am I
missing a reference? I don't think I am but maybe on of you MS gurus can help
me.

(Taken directly from Office help)
********************************

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

*********************************

Specifically it fails on:

"Set appOffice = Application.OfficeDataSourceObject"

reporting that "Method or data member not found." for
"OfficeDataSourceObject" so how can I make OfficeDataSourceObject a member of
the Powerpoint Application object?  A decent google search has offered me
nothig that I have been able to make sense of.

Cheers,
Mr. Smith
Steve Rindsberg - 06 Jun 2006 06:39 GMT
> *********************************
>
[quoted text clipped - 5 lines]
> "OfficeDataSourceObject" so how can I make OfficeDataSourceObject a member of
> the Powerpoint Application object?  

If you can find a working example of this code in another application, find out
what references have been set in the project.

The PowerPoint application doesn't have an OfficeDataSourceObject .... er ...
object.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Mr. Smith - 06 Jun 2006 08:34 GMT
> > *********************************
> >
[quoted text clipped - 17 lines]
> PPTools:  www.pptools.com
> ================================================

Stupid OfficeDataSourceObject doesn't work at all.

If anyone cares,  Here's how to do it, just make sure you include "Microsoft
ActievX Data Objects 2.x" reference in you workbook, PPT or Document

--------------------------------

Sub tester()

   Dim rst As New ADODB.Recordset
   Dim cnn As ADODB.Connection
   
   Set cnn = New ADODB.Connection
   cnn.ConnectionString = "Provider=Microsoft.Access.OLEDB.10.0;Persist
Security Info=True;Data Source=10.15.1.66\Refresh;User
ID=UserName;Password=Passowrd;Initial Catalog=DatabaseName;Data
Provider=SQLOLEDB.1"
   cnn.Open
   
   rst.Open "tblName", cnn
   
   rst.Close
   cnn.Close
   
End Sub

----------------------------------

Seriously, I think its about time I became an MVP   :S

Mr.Smith
Steve Rindsberg - 06 Jun 2006 15:56 GMT
> Stupid OfficeDataSourceObject doesn't work at all.

I expect it does somehow or another but there's very little documentation on any of
this stuff that seems to have any relationship to the real world.  Never have so
many expended so many words doing so little for so few.  ;-)

Here's another take on this, by the way:

Controlling Office Applications from PowerPoint (by Access MVP Naresh Nichani)
http://www.rdpslides.com/pptfaq/FAQ00795.htm
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.