Re: Macro that generates a prompt box(?) that once selected insert



You've fallen into a trap that gets about a dozen posters a year.
There are two lines in that macro that end with an underscore, which
is a "line continuation character" to tell VBA that the next line is
part of the same statement. But the underscore MUST be preceded by a
space, which you have left out.

See http://www.word.mvps.org/FAQs/MacrosVBA/_AtEndOfLine.htm.

If you had simply copied and pasted the macro, you wouldn't have had
that problem, but the space is small in that font and easy to miss
when you're retyping the code.

On Sat, 10 Nov 2007 17:41:01 -0800, MIrving
<MIrving@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Hi Doug - I have worked my way through
http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm
and the steps all made a lot of sense (thanks).

When I tested it, however, I got the following prompt error: "Compile error:
Method or data member not found" and when I cick 'ok' Private Sub
CommandButton1_Click() is highlighted in yellow and the cursor is at the word
'Range' .Bookmarks("Text1").Range_

What have I done wrong?


"Doug Robbins - Word MVP" wrote:

You have a little bit of learning to do.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

and then the following page of fellow MVP Greg Maxey's website

http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm


--
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

"MIrving" <MIrving@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:58A2A986-9A7A-45CF-8A1E-D803F5DD1D98@xxxxxxxxxxxxxxxx
I would be sincerely grateful for any assistance with the following. I have
limited macro recording experience and no experience with Visual Basic,
but
would like to know if (with my lack of experience) the following is
something
I could achieve. I am extremely keen to try and learn.

I would like to set up a macro that runs when a toolbar button is clicked
that achieves the following:
1. A prompt box (?) comes up in the style of a form.
2. The form has a pull-down list of four cities.
3. Depending on which city is selected, a list of companies appears
underneath.
4. Next to each company is a button or box that can be selected.
5. Once the user selects the companies they want, the user clicks on a
button at the end of the prompt box that says 'Insert'.
6. The selected companies are then inserted into a table in the Word
document.

I know it is a big ask, but if anyone would be kind enough to step me
through how I could go about this, I would be extremely grateful.




--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
.