p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access VBA (http://p2p.wrox.com/forumdisplay.php?f=80)
-   -   Shell Function Question (http://p2p.wrox.com/showthread.php?t=5993)

SerranoG November 10th, 2003 05:33 PM

Shell Function Question
 
I can successfully use the SHELL function to open a Word XP document from Access XP. There used to be a switch in Word '97 (/r) that would force the document to open Read-Only. Word XP doesn't seem to have this switch. Is there another way to do it? Here is the line of code that works, but needs a switch after the "EXE":
Code:

dblRetVal = Shell("C:\Program Files\Microsoft Office\Office10\WINWORD.EXE " & strWordCondDoc, 3)

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division

pmmgpgp November 10th, 2003 07:28 PM

A possible work around.

1 - if "workfile.doc" exist delete it
2 - Copy "origional" word file to "workfile.doc".
3 - Make "workfile.doc" read-only.
4 - Open "workfile.doc".

You would need to wait for 1 to finish before
doing 2 and the same for 2 finishing before 3
etc.

If the file is large, 2 might take awhile.

If You find no better solution, there is "code"
to take care of the "waiting", let me know if
You'd like Me to track it down.

Dave


pmmgpgp November 10th, 2003 07:57 PM

Here ( http://www.developerfusion.com/show/107/ )
 is the code to wait that I mentioned earlier.

You might be able to just change the attribute to "read-only",
then open it , and change it back after closing word.
You will still need to wait for each step to complete.






SerranoG November 12th, 2003 08:55 AM

Quote:

quote:Originally posted by pmmgpgp
1 - if "workfile.doc" exist delete it
2 - Copy "origional" word file to "workfile.doc".
3 - Make "workfile.doc" read-only.
4 - Open "workfile.doc".
If I could do Step 3 then I would just open the original file using Step 3 and not bother with WorkFile.doc.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division

pmmgpgp November 12th, 2003 07:57 PM

Greg

Surely You can ( but the file will remain ReadOnly after You close Word ).

If that meets You needs, go ahead and try it.

Dave



All times are GMT -4. The time now is 11:43 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.