Open documents

Open documents

Anonymous
Not applicable
309 Views
5 Replies
Message 1 of 6

Open documents

Anonymous
Not applicable
This one is a simple one but not to me.
I know that the Shell function opens a .exe
Shell "word.exe", vbNormalFocus
but what do you use to open a particular document
eg C:My Documents\help.doc

All help appreciated, thank you
0 Likes
310 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
You can use the ShellExecute() API or you can
use "START " with the Shell function.

"richardm73" wrote in message
news:f0a81f3.-1@WebX.maYIadrTaRb...
> This one is a simple one but not to me.
> I know that the Shell function opens a .exe
> Shell "word.exe", vbNormalFocus
> but what do you use to open a particular document
> eg C:My Documents\help.doc
> All help appreciated, thank you
>
>
0 Likes
Message 3 of 6

Anonymous
Not applicable
is this ok to do it this way?
Sub readfile(fullPathName)
Dim myappid As Variant
Dim appname As Variant '(1) As Variant
appname = "C:\Windows\notepad.EXE " & fullPathName
On Error Resume Next
myappid = Shell(appname, 1) 'vbMaximizedFocus) ' Run notepad
AppActivate myappid ' Activeate notepad with document loaded
End Sub
I don't know enough about the shell command to know how to use the Start
command?
could you explain? or where can I read more about shell - the help doesn't
say much
I couldn't fine ShellExecute in the help either - i guess I don't know where
to look
I'm talking about help in vbaide in Autocad ... should I be looking
somewhere else for a different shell command?

Tony Tanzillo wrote in message
news:BBEF0B94ABBA77AA68463B20F46293F6@in.WebX.maYIadrTaRb...
> You can use the ShellExecute() API or you can
> use "START " with the Shell function.
0 Likes
Message 4 of 6

Anonymous
Not applicable
I don't claim to know much about the proper way to do things, but this seems to work
for me

Public Sub notepad()
Dim retval As Variant
retval = Shell("notepad.exe C:\Test.txt", vbMaximizedFocus)
End Sub


--
Kent Keller
http://kwikmcad.topcities.com/

"MP" wrote in message
news:740D23506FDE39291D27E32BD9EE8F6B@in.WebX.maYIadrTaRb...
> is this ok to do it this way?
0 Likes
Message 5 of 6

Anonymous
Not applicable
oops! a left over error line
should have been:

> Sub readfile(fullPathName)
> Dim myappid As Variant
> Dim appname As Variant '(1) As Variant
> appname = "C:\Windows\notepad.EXE " & fullPathName
> myappid = Shell(appname, 1) 'vbMaximizedFocus) ' Run notepad
> AppActivate myappid ' Activeate notepad with document loaded
> End Sub
0 Likes
Message 6 of 6

Anonymous
Not applicable
If Word is available, why not use CreateObject and have Word open
the document directly?

--
Good judgment comes from experience.
Experience comes from bad judgment.

http://www.acadx.com


"richardm73" wrote in message
news:f0a81f3.-1@WebX.maYIadrTaRb...
This one is a simple one but not to me.
I know that the Shell function opens a .exe
Shell "word.exe", vbNormalFocus
but what do you use to open a particular document
eg C:My Documents\help.doc
All help appreciated, thank you
0 Likes