Opal said:
The Shell function is something very new to me....so I have been
doing some research to try and figure this out.....if I understand
what I have been reading correctly, the Shell function calls a
.exe file. So, if I want to open something in full screen I have
to open the applicaton first and then the file...something like:
Dim RetVal
RetVal = Shell("C:\Program Files\Microsoft Office\OFFICE11\EXCEL.exe", 3)
Application.FollowHyperlink "D:\My Documents\Test.xls", , True
If I do the same with powerpoint there is a lag from the time the
application opens the actual file to open. However indicating "3" as my
windowstyle does open the application full screen.....
You can probably do better than that. Shell doesn't so much run an
executable as it runs a command line, including an executable and any
command-line arguments it accepts. So if the executable you want to execute
accepts command-line arguments including, for example, the name of the file
to open, then you can do it all in one call to Shell:
Shell "excel.exe ""D:\My Documents\Test.xls""", vbMaximizedFocus
You may or may not have to specify the full path to the executable,
depending on whether it's in your system's PATH string. I find that I don't
have to give the full path to msaccess.exe or excel.exe, but you may find
different.
Am I doing this correctly? My other concern is that some computers
accessing this database will not have office directly installed on them
but rather run the program through a server so I don't think this will
work for my purposes.
If all you need to do is open the file, maximized, in the application that
is registered for that filetype, then you can do it by calling the
ShellExecute API with the file to be opened. That will identify the
appropriate application to open the file, start it in the requested window
mode, and tell it to open the file. You don't need to know the application
or where its executable is located. Code to call ShellExecute can be found
here:
http://www.mvps.org/access/api/api0018.htm
API: Start an app with ShellExecute
My concern is that you said something about starting PowerPoint in slideshow
mode. I'm not familiar with PowerPoint, so don't know if just starting the
application maximized and opening a .pps file will do that. There may be
command-line arguments that can be specified to control its behavior. If
you need to pass command-line arguments, you can do it with Shell, but I
don't know if or how there's a way to do this when you call the Windows
ShellExecute function.