Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Todd K. Todd K. is offline
external usenet poster
 
Posts: 27
Default Very Public Functions

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?
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Very Public Functions

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.
--
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

"Todd K." wrote in message
...
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?



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Very Public Functions

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.

--

Graham Mayor - Word MVP

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


Todd K. wrote:
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?



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Todd K. Todd K. is offline
external usenet poster
 
Posts: 27
Default Very Public Functions

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


"Graham Mayor" wrote:

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.

--

Graham Mayor - Word MVP

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


Todd K. wrote:
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?




  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Todd K. Todd K. is offline
external usenet poster
 
Posts: 27
Default Very Public Functions

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.

"Doug Robbins - Word MVP" wrote:

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.
--
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

"Todd K." wrote in message
...
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?






  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Very Public Functions

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.

--

Graham Mayor - Word MVP

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


Todd K. wrote:
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


"Graham Mayor" wrote:

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.

--

Graham Mayor - Word MVP

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


Todd K. wrote:
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?



  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Todd K. Todd K. is offline
external usenet poster
 
Posts: 27
Default Very Public Functions

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

"Graham Mayor" wrote:

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.

--

Graham Mayor - Word MVP

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


Todd K. wrote:
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


"Graham Mayor" wrote:

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.

--

Graham Mayor - Word MVP

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


Todd K. wrote:
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?




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I make a 10 minute presentation out of 5 pages? jarhead Microsoft Word Help 8 April 1st 06 07:22 AM
How to set up an automatic archive of city council committees' public notices [email protected] Microsoft Word Help 0 December 12th 05 03:48 PM
I am unable to see my exchange server public contacts when using . TJR Mailmerge 3 May 2nd 05 02:15 AM
I am unable to see my exchange server public contacts when using . r90flyer Mailmerge 0 March 2nd 05 05:41 PM
template protection and ink functions Doug J Microsoft Word Help 0 January 18th 05 04:25 PM


All times are GMT +1. The time now is 12:34 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"