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 / Mailmerge and Fax / February 2007

Tip: Looking for answers? Try searching our database.

Very Public Functions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Todd K. - 01 Feb 2007 20:40 GMT
I am utilizing some MailMerge code from Anne Troy to open a Word Merge
document from Access, make a copy of the merged document, and close the
original without saving.  The code works perfectly on my computer, but this
is to be used by the whole department (both Word Document and Data Source
reside on our server).  When I tried it from another computer (let's call it
Computer B), the first thing it did was nothing.  Once I reduced the security
in computer B's Word to low, it read the document's "On Open" code, but could
not find the public "DoMailMerge" function.  I copied the "public" function
to computer B's NORMAL, and now it works great except it keeps asking me to
verify the data source.

1. Is there a better way to get everyone access to the function besides
recopying it into everyone's NORMAL?
2. Why do I have to keep verifying the data source on Computer B and not on
mine?
Doug Robbins - Word MVP - 02 Feb 2007 06:36 GMT
How about making the functions really public and copy the code into your
message so that we can see what it is trying to do.

Also, however, if it is an Access application, maybe you should post the
question to an Access Newsgroup.
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

>I am utilizing some MailMerge code from Anne Troy to open a Word Merge
> document from Access, make a copy of the merged document, and close the
[quoted text clipped - 18 lines]
> on
> mine?
Todd K. - 02 Feb 2007 13:28 GMT
Sorry, since I received two replies I responded (with the code) to the latest
one.  The Access code isn't the problem, all it does is open up the Word
document.  That part works great.  I would like to code the Word merge
document so that if anyone double-clicked on it, it woudl pull from a
specific data source, make a copy of itself, and close itself without
changes.  See code in other response.

> How about making the functions really public and copy the code into your
> message so that we can see what it is trying to do.
[quoted text clipped - 23 lines]
> > on
> > mine?
Graham Mayor - 02 Feb 2007 06:40 GMT
You should not be setting other people's macro security to low. They could
unwittingly run malicious macro code.
The better plan would be to put the code in a shared global template and set
the macro security to trust installed templates and add-ins and back to
medium. Macros in documents are always going to cause security issues which
is why they are better in templates.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> I am utilizing some MailMerge code from Anne Troy to open a Word Merge
> document from Access, make a copy of the merged document, and close
[quoted text clipped - 12 lines]
> 2. Why do I have to keep verifying the data source on Computer B and
> not on mine?
Todd K. - 02 Feb 2007 13:25 GMT
Shared global template?  You just lost me.  I did consider putting all of the
code (including the function and OpenDataSource) in the document, but it is
struggling with the line With ActiveDocument.MailMerge.  Here is the total
code:

Dim DocName$
DocName = ActiveDocument.Name
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Execute
End With
Windows (DocName).close wdDoNotSaveChanges

> You should not be setting other people's macro security to low. They could
> unwittingly run malicious macro code.
[quoted text clipped - 19 lines]
> > 2. Why do I have to keep verifying the data source on Computer B and
> > not on mine?
Graham Mayor - 02 Feb 2007 14:58 GMT
The simplest way to deal with this is to save that code in the document with
the macroname AutoNew
Save that document as a template.
Use a shared workgroup template location
http://www.gmayor.com/Template_Locations.htm
Create a new document from the template, the code runs, closes that new
document and leaves the merged doc on screen.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Shared global template?  You just lost me.  I did consider putting
> all of the code (including the function and OpenDataSource) in the
[quoted text clipped - 40 lines]
>>> 2. Why do I have to keep verifying the data source on Computer B and
>>> not on mine?
Todd K. - 02 Feb 2007 15:06 GMT
I just figured out that putting this code in the Word Merge document works.  
I think this will work on medium security, it's just going to ask everytime
if you want to open it.

Private Sub Document_Open()

Me.MailMerge.OpenDataSource _
Name:="I:\Applications\Coal Severance\LGP0204x.mdb", _
LinkToSource:=True, _
Connection:="TABLE TblRptCompletion", _
SQLStatement:="SELECT * FROM [TblRptCompletion]"
Me.MailMerge.Destination = wdSendToNewDocument
Me.MailMerge.Execute
Windows(Me).Close wdDoNotSaveChanges

End Sub

> The simplest way to deal with this is to save that code in the document with
> the macroname AutoNew
[quoted text clipped - 48 lines]
> >>> 2. Why do I have to keep verifying the data source on Computer B and
> >>> not on mine?
 
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.