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 / Word / Programming / January 2006

Tip: Looking for answers? Try searching our database.

OpenDataSource using Excel workbook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NJS - 11 Jan 2006 02:02 GMT
Good day all!
I need to use OpenDataSource to automatically re-connect/refresh a doc.
I always get prompted for the 'sheet' even though there is only one
worksheet in the workbook
Is there any way to suppress this prompt, and default to sheet1$ (or
whatever)??
thank you
Doug Robbins - Word MVP - 11 Jan 2006 05:19 GMT
The following is a recorded macro of the action of attaching a sheet from an
Excel file as a data source:

   ActiveDocument.MailMerge.OpenDataSource Name:= _
       "C:\Documents and Settings\Doug Robbins\My Documents\My Data
Sources\testsource.xls" _
       , ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
       AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="",
_
       WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False,
_
       Format:=wdOpenFormatAuto, Connection:= _
       "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data
Source=C:\Documents and Settings\Doug Robbins\My Documents\My Data
Sources\testsource.xls;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet
OLEDB:System database="""";Jet OLEDB:Registry Path=" _
       , SQLStatement:="SELECT * FROM `Sheet2$`", SQLStatement1:="",
SubType:= _
       wdMergeSubTypeAccess

Also checkout the OpenDataSource item in the Visual Basic Help file.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Good day all!
> I need to use OpenDataSource to automatically re-connect/refresh a doc.
[quoted text clipped - 3 lines]
> whatever)??
> thank you
NJS - 11 Jan 2006 06:20 GMT
Excellent!, thanks Doug

> The following is a recorded macro of the action of attaching a sheet from an
> Excel file as a data source:
[quoted text clipped - 25 lines]
> > whatever)??
> > thank you
 
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.