macro to unprotect / protect sheet in word

G

Guest

Can anyne help, I have a macro in a word document that is used to create
extra copies(different page headers), when the sheet is protected(only
certain cells are completed by the user) the marco will not run..how can i
get round this.
current macro-

Sub ADVICENOTE()
'
' ADVICENOTE Macro
' Macro recorded 22/03/2006 by mchallacombe
'

Selection.WholeStory
Selection.Copy
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.TypeParagraph
Selection.InsertBreak Type:=wdPageBreak
Selection.PasteAndFormat (wdPasteDefault)


End Sub
 
C

Charles Kenyon

I would recommend posting this in the vba.beginners newsgroup rather than in
this one.

First, though, read
http://word.mvps.org/FAQs/MacrosVBA/TurnFmFlfResetOff.htm which will show
you good code for protecting / unprotecting word documents.

The code you have posted would insert a page break in an unprotected
document. It has nothing to do with headers directly. It has nothing to do
with tables (which is where one finds cells). What are you trying to change
in the header? Why were you inserting a manual page break? (Generally manual
page breaks should be avoided.)
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
G

Guest

Thanks, well, its a simply document that replaces an 'hand written' dpcument
bu use of of carbon copy pad (2 copies to a Customer, 2 to our business)or
though 1 to us would be suffucient.

As know one where I work really understands word, It has been left to me. :(

The cut/paste macro is used as page 1 have 'customer' copy as a header, 'RR
copy' as the other header.(we simply print 2 copies of each) & the only way i
could do this was a different header on odd & even pages. its the only way i
could find to print the same information on another sheet, but with a
different header.

The protection is where only certain fields need to be completed, which
avoids any unessasary modifing of other fields etc.

any help really is appreciated!!
 
C

Charles Kenyon

Create a second page in your form template while it is unprotected. Then
copy everything from the first page to the second page. Replace the form
fields on the second page with REF fields that will reproduce the
information that is typed on the first page.
http://gregmaxey.mvps.org/Repeating_Data.htm

Rather than use the header, I would insert Word Art (Insert > Picture) to
say Customer Copy. You right click on this to change the format. On the
layout tab, change it to "behind text." Then you can move it into your
margin.

Finally, reprotect and save your template. Now you can produce new documents
(File > New) and just enter the information once. To print only your
original, print just page 1. To print a customer copy, print page 2. To
print both, print the whole document.

What you are talking about is what Word calls an "online form." Check this
in help. For more about online forms, follow the links at
http://addbalance.com/word/wordwebresources.htm#Forms or
http://word.mvps.org/FAQs/Customization/FillinTheBlanks.htm especially Dian
Chapman's series of articles. You may also want to look at
http://www.word.mvps.org/FAQs/TblsFldsFms/LinesInForms.htm.

Hope this helps,
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

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