RunApp Macro

J

Jasper Recto

Is it possible to put a variable in the RunApp action? I have a form that
prompts the user for a File name. I have a Macro that runs after the user
hits enter. The Macro is a RunApp action that opens Microsoft Word. I
would like to some how open the file the user was just prompted for. How
could I get the RunApp action to do this? Is there another way of doing
this task?

Thanks!!!
Jasper
 
V

Van T. Dinh

Not sure about Macros but it is much easier to do with VBA
code.

The following simple VBA Sub picks up the full-path name
of the Word doc in a TextBox and opens it using Word.exe.

****Tested in AXP****
Public Sub OpenWordDoc()
Shell """C:\Program Files\Microsoft Office\Office10
\WINWORD.EXE"" """ & Forms!Form1!Text3 & """",
vbNormalFocus
End Sub


(beware of line-wrapping: there is only 1 statement on 1
line in the Sub).

HTH
Van T. Dinh
MVP (Access)
 
M

Matthew Therrien

That's neat. Where would you put this code or how it would
be activated - on the After Update event of the text box
or..

I am new to this but would like to use it too.

Many thanks

Matthew
 
V

Van T. Dinh

I normally use a CommandButton and in this case, simply put the code in the
CommandButton_Click Event.

AfterUpdate Event should work fine but this means that as soon as the user
tabs / moves out of the Control, the code will run. I prefer to leave the
user to make a conscious decision to run it.
 

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

Runapp to another database 3
Shell / RunApp 1
Excel Data Transfer Issue (strange situation) 1
Runapp with Sendkeys 2
error on print job 1
RunApp question 2
Opening a Word file from Access 1
RunApp 3

Top