Visual Basic outputs into new blank document

B

Beth Mc

I saw this macro in another answer. What if I want this macro to list the
bookmarks in a new blank doc instead of printing it out? What would I need to
change the ".printout" to?

Thanks,
Beth
 
R

Roger Whitehead

Comment-out or delete the lines:

.Printout 'To prevent auto-printing
.Close wdDoNotSaveChanges



--
HTH
Roger
Shaftesbury (UK)


Beth Mc said:
I saw this macro in another answer. What if I want this macro to list the
bookmarks in a new blank doc instead of printing it out? What would I need
to
change the ".printout" to?

Thanks,
Beth
 
B

Beth Mc

I'm not sure I understand what you wrote. If I don't put in the line
".Printout" will Word automatically open a new blank doc and put the info
into it? And how does the ".Close wdDoNotSaveChanges" help me?

Thanks,
Beth

Roger Whitehead said:
Comment-out or delete the lines:

.Printout 'To prevent auto-printing
.Close wdDoNotSaveChanges
 
R

Roger Whitehead

If I understood you correctly, you want a new document with the Bookmarks
listed. The code you offered did that, but printed the new document, then
closed it without saving:


'***This code adds a blank document-
Set DocList = Documents.Add


With DocList

'***This code Adds text "Here is a list......... etc:
.Range.Text = "Here is the list of bookmarks in " _
& CurDocName & ":" & Chr(13) & Chr(13) & MyList


'***This code prints the document
.PrintOut


'***This code closes the document, without bothering to ask you if you want
to save:
.Close wdDoNotSaveChanges
End With

Or did I misunderstand? If so sorry, please clarify.
--
HTH
Roger
Shaftesbury (UK)
 
B

Beth Mc

Roger:
That's perfect. I was just very confused - (hey, it's monday!). Now I've had
my second cuppa and it's making perfect sense. Thanks!!

Beth
 

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