View Single Post
  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Mona-ABE Mona-ABE is offline
external usenet poster
 
Posts: 2
Default Using SharePoint list as MailMerge Data Source (Word 2007)

Thanks for the quick reply, Peter!

I did try to use your code in my document and I replaced it with the URL of
my sharepoint site and I ran into an error:

Run-time error '9105':
String is longer than 255 characters

This was the section of code the debuger was stopping on and there seems to
be an issue with the SQL statement

ActiveDocument.MailMerge.OpenDataSource _
Name:=strODC, _
Connection:= _
"Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & strDatabase & ";" & _
"Mode=Share Deny None;" & _
"Extended Properties=""WSS;HDR=NO;IMEX=2;" & _
"DATABASE=" & strDatabase & ";" & _
"LIST=" & strList & ";"";", _
sqlstatement:= _
"SELECT * FROM [" & strList & "]"

Any tips/suggestions you send my way are GREATLY appreciated!

I'm trying to avoid the Access DB route and I'm sitting through some Open
Office XML training as we speak to see if I can possibly develop a solution
against that technology.

--
Thanks!
Mona-ABE


"Peter Jamieson" wrote:

I've been working
for days trying to figure out how to create a Word document that

merges with
SharePoint list data.


This is an example address taken from my LAN and it's not reachable on
the Internet.

So the idea was that you substituted your own sharepoint http: address
and list name in the code. Sorry for any confusion!

That said, the sharepoint http: address would normally be quite simple,
so I hope it will be easy for you to set up a test.

If this does not work for you, the other way that you can set up such a
merge, as long as you have Access, is to create a database that contains
a table linked to the Sharepoint list, then use that as the data source
for the merge. Arguably that is simpler anyway, but I think some people
dislike the fact that they have to do everything via an Access database
that they shouldn't really need.

Or, you can use Access primarily to retrieve the list's GUID - once you
have created the linked table, you can use the Access Database
Documenter to display the list's location and GUID, then try plugging
that back into Word.

(Originally I tried writing some Word VBA to retrieve that "list of
lists" and translate a list name into a list GUID, but it has to do it
using an http/SOAP request and so far I haven't found a reliable way to
do that with VBA alone).

Let me know if I can help further. I am obviously interested to know if
this method works for you, or of course you may find a better solution.

Peter Jamieson

http://tips.pjmsn.me.uk

On 04/02/2010 13:37, Mona-ABE wrote:
Hi, Peter, I was thrilled to see that you added this post! I've been working
for days trying to figure out how to create a Word document that merges with
SharePoint list data. However, when I click on the link you provided for
your sample site, it's a broken link. Can you provide more information or an
updated link?

.