I need to have a vba macro run in a template, but I don't know how to stick them together

L

Linda

I feel totally stupid about this and embarrassed, as I have been
programming for 20 years, but I need to stuff SQL data in a word
document (template) and I am clueless.

I made the template, I managed to get into Visual Basic by choosing
Tools->Macro->Visual Basic Editor and write some VB that should pull a
recordset and write some lines. Now I have found myself wondering
WTF???

I have no idea how to save it as something I can reference inside of
the word dot.

If I click on tools->macro->macros I do not see a thing there. Yet if I
open the VBA editor the codde is right there.

If someone could explain to me how you can put the code to the .dot I
would be very grateful.

Also I have named it (I thought) and that name is showing up in the
declarations drop down on the upper right of the screen. I have no
idea if this is good or bad.

L.
 
C

Charles Kenyon

This might be a good starting point:
http://word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm
--
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.
 
J

Jonathan West

Charles Kenyon said:


In addition, this article may be useful

How to cut out repetition and write much less code, by using subroutines and
functions that take arguments
http://www.word.mvps.org/FAQs/MacrosVBA/ProcArguments.htm

Although in this case the more advanced points might not be needed, the idea
of calling one routine from another is clearly described.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
L

Linda

Thank you.

Life is improving over here as I am picking this stuff up. I hate
learning things that I would really think is cool if it were not for
deadlines LOL.

Now my last issue is that I have 4 records returning from a query and
it is too much to stuff into one text bookmark. Now I am looking for a
way to get table rows to populate dynamically, and maybe that would
save me. If you have a clue for that I would be a happy woman.

:)
Linda
 
C

Charles Kenyon

I don't know how to do what you are asking here. I suspect that Jonathon
does, but you should really post a new message with a subject line like
"dynamically create table based on number of records returned from query" to
get the best response to your question.
--
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.
 
J

Jonathan West

Linda said:
Thank you.

Life is improving over here as I am picking this stuff up. I hate
learning things that I would really think is cool if it were not for
deadlines LOL.

Now my last issue is that I have 4 records returning from a query and
it is too much to stuff into one text bookmark. Now I am looking for a
way to get table rows to populate dynamically, and maybe that would
save me. If you have a clue for that I would be a happy woman.

You can set the Range.Text property of individual cell objects within a
table. take a look at the "Populating a Table from VBA" thread in this group
for examples of how to do this. If you get stuck, by all means post back
here.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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