RunApp Macro

  • Thread starter Thread starter Jasper Recto
  • Start date Start date
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
 
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)
 
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
 
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.
 
Back
Top