OPENING A DOCUMENT

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I've saved a path and filename to a record. How do I read that record and
open the relevant document ie phil.doc as a word document or phil.xls as a
excel document,alter this document and save again?
 
If you saved it as a hyperlink, you can open the document just by clicking
the link. On my website (www.rogersaccesslibrary.com), is a small Access
database sample called "SetHyperlink.mdb" which illustrates both how to save
a document name as a hyperlink and also how it calls up the document.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Copy and Paste the following into a new module:

Private Declare Function apiShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" _
(ByVal Hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long

Public Sub OpenPrintExecute(FileLoc As String, OpenPrint As String)
Dim lngprt As Long
lngprt = apiShellExecute(0, OpenPrint, FileLoc, vbNullString, vbNullString, 1)

End Sub


On your form, create a button. On the botton's OnClick event (pick one or the
other):

'Opens the file
OpenPrintExecute me.FileLocation, "Open"

'Prints the file
OpenPrintExecute me.FileLocation, "Print"
 
Back
Top