Clear Bookmarks

G

Gabe

Is there anyway to delete all the text after a bookmark in a document? Kinda
like if you started at the bookmark and then pushed Shift+End on your
keyboard, and then Delete.

Or even better,

Is there anyway to undo all the update fields (bookmarks) at once , through
vb?
 
G

Gabe

Also, why is it that when I run a macro from a command button I can't undo
any of the previous actions?
 
J

Jay Freedman

Is there anyway to delete all the text after a bookmark in a document? Kinda
like if you started at the bookmark and then pushed Shift+End on your
keyboard, and then Delete.

Or even better,

Is there anyway to undo all the update fields (bookmarks) at once , through
vb?

Better than that: Save the unchanged document as a template (.dot file) and base
new documents on it through the File > New command. Every time you start a new
document, the fields will be empty. After they're filled in, you can save the
document, or print it and then close it without saving.
 
G

Gabe

Yes, I have done that already, but I was hoping to create a button on the
template document that will clear the fields for me. That way I don't have to
keep reopening a new template every time. Sorry I am rather lazy. I tried to
run some code that would empty the undo cache but every time I click on the
command button it doesn't work? However when I manually walk through the code
by pressing F8 it works? What is with the command button??? Here is an
example, assign it to a command button:

Private Sub cmdNew_Click()
Do
ActiveDocument.Undo (1)
Loop While ActiveDocument.Undo = True
End Sub
 
D

Doug Robbins - Word MVP

If you are using formfields, then have the code set the .Result property of
the formfield to ""

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
T

Tony Strazzeri

That way I don't have to
keep reopening a new template every time.

Hi Gabe,

What do you mean by this?
Why are you opening the template file at all?


The idea of a template file is that word creates a NEW DOCUMENT
document from the template. ie . if you double-click on the temlpate
file from Windows explorer word will create a new document from that
fil.

If the template is in the right place on your PC (ie in either of the
locations --"User Templates" or "Workgroup Templates" pointed to in
"Tools|Options|File Locations" then it will appear when you select
File|New. That will also make a new document from the temlpate.

What is hard about that? If you use the template all the time you can
create a simple macro to do the File|New and put that on a toolbar.

Hope this helps.

Cheers!
TonyS.
 
J

Jean-Guy Marcil

Gabe said:
Yes, I have done that already, but I was hoping to create a button on the
template document that will clear the fields for me. That way I don't have to
keep reopening a new template every time. Sorry I am rather lazy. I tried to
run some code that would empty the undo cache but every time I click on the
command button it doesn't work? However when I manually walk through the code
by pressing F8 it works? What is with the command button??? Here is an
example, assign it to a command button:

Private Sub cmdNew_Click()
Do
ActiveDocument.Undo (1)
Loop While ActiveDocument.Undo = True
End Sub

Kind of a strange way of doing things... But if you insist, the above code
should be repalced by:
ActiveDocument.UndoClear
 

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