Modules to macros...help please!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

ive created a module in VBA to open a particular word document. But is there
a way to create a button on a form to run the module? otherwise how else will
the document open without running the module? any suggestions please!?
 
Hi Tori
In the module, did you created a function that open that word document?

If you did, on the OnClick event of the button you can call that function.
Either write directly in the line of the property box
=FunctionName()

Or, locate the cursor on the OnClick event, on the right you'll see a button
with three dots, click on it and select CodeView, call the function within
that sub

Sub SubName()

FunctionName

End Sub

Or, within that function you can open this word document using the
FollowHyperLink

Sub SubName()

Dim WordNameAndPath As String
WordNameAndPath = "C:\DocName.Doc"
Application.FollowHyperlink WordNameAndPath

End Sub
 

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

Back
Top