Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2022, 03:57 PM
Souriane Souriane is offline Open MailMerge Documents and Ignore SQL Security Message Windows 7 64bit Open MailMerge Documents and Ignore SQL Security Message Office 2013
Advanced Beginner
Open MailMerge Documents and Ignore SQL Security Message
 
Join Date: Feb 2017
Location: Quebec, Canada
Posts: 82
Souriane is on a distinguished road
Question Open MailMerge Documents and Ignore SQL Security Message

Hi,



I have 500 templates all linked to different databases for Mail merging. Last week, our DNS servers changed name so when we open these templates, it's a mess!

I have a macro that will open each template and reassigned the proper MailMerge DataSource and SQL Statement.

My problem is when the macro opens the documents, there is the SQL Security message that appears and now that I am working in VDI, I am no longer allowed to toggle the Security in the Registry Editor and the administrator won't allow me.

Is there a code to add to the macro to ignore the SQL Security message when it opens each document?

Thank you for your help!

Souriane
Reply With Quote
  #2  
Old 01-12-2022, 04:11 PM
Guessed's Avatar
Guessed Guessed is offline Open MailMerge Documents and Ignore SQL Security Message Windows 10 Open MailMerge Documents and Ignore SQL Security Message Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

This works in Excel - does it work with Word too?
Application.DisplayAlerts = False
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 01-12-2022, 04:25 PM
Souriane Souriane is offline Open MailMerge Documents and Ignore SQL Security Message Windows 7 64bit Open MailMerge Documents and Ignore SQL Security Message Office 2013
Advanced Beginner
Open MailMerge Documents and Ignore SQL Security Message
 
Join Date: Feb 2017
Location: Quebec, Canada
Posts: 82
Souriane is on a distinguished road
Default

Good idea Guessed, but it doesn't work.
Reply With Quote
  #4  
Old 01-12-2022, 05:02 PM
Guessed's Avatar
Guessed Guessed is offline Open MailMerge Documents and Ignore SQL Security Message Windows 10 Open MailMerge Documents and Ignore SQL Security Message Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Perhaps you might try this suggestion from the Microsoft KB
You receive the "Opening this will run the following SQL command" message when you open a Word mail merge main document that is linked to a data source

It appears it would be a bad idea from a security viewpoint to leave this fix in place but it should let you apply a fix to the files.

Another alternative is to burrow into the zip version of the xml files to find the old path and replace it with the new. This would avoid the need to open the file with Word until you have reset the path.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 01-12-2022, 06:13 PM
Souriane Souriane is offline Open MailMerge Documents and Ignore SQL Security Message Windows 7 64bit Open MailMerge Documents and Ignore SQL Security Message Office 2013
Advanced Beginner
Open MailMerge Documents and Ignore SQL Security Message
 
Join Date: Feb 2017
Location: Quebec, Canada
Posts: 82
Souriane is on a distinguished road
Default

Well, this is usually THE best idea, but as I indicated in my initial message, I no longer have access to the Registry Editor. This is why I am trying to find a workaround...
Reply With Quote
  #6  
Old 01-12-2022, 09:24 PM
gmayor's Avatar
gmayor gmayor is offline Open MailMerge Documents and Ignore SQL Security Message Windows 10 Open MailMerge Documents and Ignore SQL Security Message Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

While it may not endear you to your IT support, you don't actually need to edit the registry directly to toggle the setting - you can do it with a macro. See the last macro at Word VBA examples.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #7  
Old 01-13-2022, 06:50 AM
Souriane Souriane is offline Open MailMerge Documents and Ignore SQL Security Message Windows 10 Open MailMerge Documents and Ignore SQL Security Message Office 2019
Advanced Beginner
Open MailMerge Documents and Ignore SQL Security Message
 
Join Date: Feb 2017
Location: Quebec, Canada
Posts: 82
Souriane is on a distinguished road
Default

Thanks Mr. Mayor. I've already been using your great macro for years! Unfortunately, it is not only that I can't open the Registry Editor anymore, it's also that I can't edit any key registry at all with VBA.

I tried to see if I could use SendKeys to respond to the window but wasn't able to make it happen.

In fact, what I want is to unlink the document with the database upon opening.
Any suggestion?

I tried myDoc.MailMerge.MainDocumentType = WdMailMergeMainDocType.wdNotAMergeDocument
but it won't work as the document must be open to work and as long as the SQL Security message shows, well, it is not open yet..
Reply With Quote
  #8  
Old 01-13-2022, 04:42 PM
Guessed's Avatar
Guessed Guessed is offline Open MailMerge Documents and Ignore SQL Security Message Windows 10 Open MailMerge Documents and Ignore SQL Security Message Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I did some testing and this works for me in Word. I can also use False instead of wdAlertsNone. I have no idea on why that doesn't work for you.
Code:
Sub TestOpen()
  Application.DisplayAlerts = wdAlertsNone
    Documents.Open FileName:="C:\aaa\MailMergeTest.doc"
  Application.DisplayAlerts = wdAlertsAll
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #9  
Old 01-14-2022, 02:21 PM
macropod's Avatar
macropod macropod is offline Open MailMerge Documents and Ignore SQL Security Message Windows 10 Open MailMerge Documents and Ignore SQL Security Message Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Souriane View Post
I have a macro that will open each template and reassigned the proper MailMerge DataSource and SQL Statement.

...

Is there a code to add to the macro to ignore the SQL Security message when it opens each document?
See Run a Mailmerge from Excel, Sending the Output to Individual Files in the Mailmerge Tips & Tricks 'Sticky' thread at the top of the Mailmerge forum: https://www.msofficeforums.com/mail-...ps-tricks.html
As demonstrated there, you will need to include the SQL statement in the VBA code. This applies to any code that disables the SQL message, not just to the code in the article.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide Security Message and Print rosscortb Word VBA 1 05-11-2017 03:39 AM
Open MailMerge Documents and Ignore SQL Security Message When loading existing documents (*.docx) they load with Security Warning - Macros have been disabled Franci Word 3 05-20-2016 04:33 AM
Open MailMerge Documents and Ignore SQL Security Message Mailmerge Individual Documents DaddyMac Mail Merge 4 06-06-2013 09:22 PM
Excel 2007 security alert - data connection message every time? michael.monaco Excel 0 12-20-2012 07:47 AM
Open MailMerge Documents and Ignore SQL Security Message Open Word = security warning, changes hard drive sleepymia Word 1 05-28-2012 05:49 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:30 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft