using Keyboard shortcuts v using menu options - vba

J

Jules

Hi,

I'm having a wierd and annoying problem with Word's own keyboard
shortcuts. When using the shortcuts instead of the menu options, a
global array which has been populated earlier is empty. When using the
menu options the array is populated. The keyboard shortcut is doing
something but I'm not sure what. Can anyone explain?

I have setup my own code for Word functions i.e. FilePrint() and
FilePrintDefault() both run my function docPrint(). When I click on
Print in the File menu the array is populated, when I press "Cntrl-P"
it is not. Any help would be much appreciated.

Cheers,

Jules
 
C

Cindy M -WordMVP-

Hi Jules,

ctrl+P would be the equivalent of FilePrint. First thing I'd do would be
to stick a couple of Debug.Print or MsgBox lines in the code, starting
with Sub FilePrint, and see whether the code actually works through this
function.
I'm having a wierd and annoying problem with Word's own keyboard
shortcuts. When using the shortcuts instead of the menu options, a
global array which has been populated earlier is empty. When using the
menu options the array is populated. The keyboard shortcut is doing
something but I'm not sure what. Can anyone explain?

I have setup my own code for Word functions i.e. FilePrint() and
FilePrintDefault() both run my function docPrint(). When I click on
Print in the File menu the array is populated, when I press "Cntrl-P"
it is not. Any help would be much appreciated.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
J

julian.virtue

Hi Cindy,

Thanks for your reply. I have tested this and I was aware that "Ctrl-P"
was the equivalent of "FilePrint". I have written my own sub procedures
called "FilePrint" and "FilePrintDefault" that are run instead of Words
own functionality. The code works when the buttons are pressed on the
toolbar or when the menu option is used but not when "Ctrl-P" is used.

The code does run but the array that has been populated in a previously
run procedure, contains no values.

Effectively what I'm doing is storing values that users have entered
into Word FormFields into an array. When a user goes to print the
document, the document gets "locked" first. i.e. the code takes the
values out of the form fields and deletes the fields. In their place
the value that the user entered is placed on the document and then the
document is protected. This way a user can enter their data and then
lock the document so no one can edit it later.

I have found a work around to this problem but the keyboard shortcut
issue still remains.

Cheers, I appreciate your answer.

Jules
 
C

Cindy M -WordMVP-

Hi (e-mail address removed),
Effectively what I'm doing is storing values that users have entered
into Word FormFields into an array. When a user goes to print the
document, the document gets "locked" first. i.e. the code takes the
values out of the form fields and deletes the fields. In their place
the value that the user entered is placed on the document and then the
document is protected. This way a user can enter their data and then
lock the document so no one can edit it later.
I'd just loop through the fields collection and use the .Unlink method
(or do ActiveDocument.Fields.Unlink if it works to just do them all).

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
J

Jules

Thanks - I have to be able to go back and to keep things interesting
it has to work from Word 97 and above. I've used bookmarks to bookmakr
the value of the formfield when it is stored as a word in a document.
The name of the bookmark gives the characteristics of the formfield,
so I can go back to the previous state. Got there in the end. Thanks,
Jules
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top