How do you take the VBA from a MS Word Macro and make it work in Access

S

salty_gu_ru

Hello,
I’m trying to get a macro I created in MS word to work in Access. All it
dose is insert repetitive a sentence into your text by hitting a button on
the tool bar. It would be a real time saver for me in Access if I could
click a command button to insert a pre defined sentence at the cursor, among
my own text in a field. If their is better way to get the result im looking
for I am all ears.
Here is the code from word I’ve been tinkering with no result. Please Help.
Thanks.


Sub Macro1()
'
' Macro1 Macro
' Macro recorded 11/14/2006 by Stephen
'
Selection.TypeText Text:="Sample Text"
End Sub
 
J

John Spencer

Where is the command button? Is it in a menubar or is it on the form
itself?

If the button is on the form itself, then unless you are going to insert the
text at the beginning or end of control's value you will have to keep track
of the position of the cursor at all times.

If you are going to use a button on a menu bar, you will have to write a
function since buttons (and menu items) cannot call subs.

More information please.
 

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