Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Ques. on VBA in Access and Bookmarks in Word

Ques. on VBA in Access and Bookmarks in Word

Ques. on VBA in Access and Bookmarks in Word

I have a Word document with Formsfields defined in it and they are also password protecded.

Can anyone help me with the VBA Code to execute in Access, behind a form, that will sent over the document password, (after I've opened it via code), so I can then send over the data to the bookmarked area in the document?

Thanks in advance for any assistance you can offer.

RE: Ques. on VBA in Access and Bookmarks in Word

Dim woobj As Word.Application
Set woobj = CreateObject("Word.Application")
woobj.Visible = True
woobj.Documents.Open FileName, , , , Password

RE: Ques. on VBA in Access and Bookmarks in Word

Thanks, but now I see my problem is more complicated.

I have a Word document that is procted but there are a few areas on the docuemnt that I created 'forms' from the 'forms' toolbar and set bookmarks in them.  I want my code to send over (from Access 2000) data - referencing those bookmarks inside my form boxes, but I get an error that says I can't  write data into them as they're protected.  Yet I can open the document and type data in them manually.  I need to somehow send over data to a bookmark inside a form box on a Word document that is password protected.  Any help in this would be appreciated.

RE: Ques. on VBA in Access and Bookmarks in Word

CODE --> vba

If ActiveDocument.ProtectionType <> wdNoProtection Then
    ActiveDocument.Unprotect (strPassword)
End If

RE: Ques. on VBA in Access and Bookmarks in Word

This all works OK, but the last step is, after inserting my data into the "form field' in my document from code, I lock up the document again, to protect it from user making unauthorized changes.  Problem is, what happens then is, the form field that I just inserted by data into, from VBA code, becomes locked like the rest of the document.  Its as if it doesn't become a 'form field' anymore but changes to just another part of the 'protected' document.  It would be nice to only have these 'form field' areas always unlocked, no matter how they get filled with data.

Thanks for any suggestions.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close