PDA

View Full Version : [SOLVED] Access to word document fails



gelfling
04-17-2005, 02:08 AM
Please help me out here.
I am a complete newbie in VBA world.
It is very hard for me to explain everything in correct english because i use a Dutch version of Office 2003.

Config:

Windows xp sp2 Dutch
Office Professional 2003 Dutch


Problem:

I use the following sub to call a word document:


On Error GoTo Err_Knop3_Click
Dim oDoc As Object
Dim strBestand As String
strBestand = "c:\test.doc"
Set oDoc = CreateObject("Word.Application")
oDoc.Visible = True
oDoc.Documents.Open (strBestand)
oDoc.Activate
Exit_Knop3_Click:
Exit Sub

Word opens the right document, but the merge options are grayed out. In the original document it all works perfect, but opened from the access form, the document looses all mysql merge options.
I know there is an option to merge a query direct into word for a mailing to a printer. But i want to automate it.

What is the best solution to solve my problem?
Please help me out here, i'm starting to like access as it is, but the vba is a bit hard for me at the moment.

Killian
04-18-2005, 06:01 AM
Hi and welcome to VBAX :hi:

This sounds like an issue I ran across before - MS have closed a number "security loopholes" in their regular updates, one that prevents the SQL connect for the merge from being run from VBA.
There's an registry hack to open it back up detailed here:
http://support.microsoft.com/defaul...KB;EN-US;825765

gelfling
04-18-2005, 08:31 AM
SUPERB!

This really did the trick! Thank you very much, I had no idea anymore.
I tested it, and it just works great!
Next step is to automate this by vba code, but I think I can manage that now.

Once again, a forum really helped me out, thanks Killian. Keep up the good work by helping others. :bow: