Newbie macor vba script

  • Thread starter John Taylor-Johnston
  • Start date
J

John Taylor-Johnston

Hi,
I'm new at this. I would like to pause my Word97 macro and input the content for Name:=""

as in Name:="Albion2"

How can I re-write this please?

Someone suggested:

rng = InputBox "Please enter a range name"
.Add Range:=Selection.Range, Name:=rng

But that invokes the File/Save-as window? What I really need to to be able to pause and input the data in the bookmark window.

I know Word97 is oldish, but still very useful for what I do. I bought and have the 2000 CD, but never got around to installing it, would you believe.

John

Sub f12()
'
' f12 Macro
' Macro recorded 15/11/04 by jtjohnston
'
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="Albion2"
.DefaultSorting = wdSortByLocation
.ShowHidden = False
End With
End Sub

{I've also cross-posted [Sorry, bad for me to do] in microsoft.public. I'm not sure which is the appropriate newsgroup? Some have very little traffic too. Pertains to VBA or Macros? Both?!}
 
J

Jeff

John

Instead of trying to second-guess a technical solution, why not simply
explain in lay terms what EXACTLY is the problem you are trying to solve?
 
H

Helmut Weber

Hi John,
looks like the beginners' group would be the right one for you.
Nevertheless,
select the text you want to apply a bookmark to and,
if you really must have the according dialog, then
Dialogs(wdDialogInsertBookmark).Show
---
There are still a lot of people, which like Word 97 best.
.... and Jeff is right, of course, even asking must be learned.
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
D

Doug Robbins

The following will open an input box into which you can enter the name of
the bookmark to be added and will then insert a bookmark with that name at
the location of the selection:

Dim bmname As String
bmname = InputBox("Enter the bookmark name", "Add Bookmark")
ActiveDocument.Bookmarks.Add bmname, Selection.Range


--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
J

Jeff

An alternative way to learn VBA is to use Tools Macro Record to record a
process then Edit the macro and use the VBA context sensitive help to
understand the macro statements that are recorded.
 

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

Similar Threads


Top