toby said:
Hi
I have a list of hyprelinks to documents and I want to be able to
print these (not view) using the shellexecute, can this be done?
any help much appreciated
toby
Copy and paste the module posted at:
http://www.mvps.org/access/api/api0018.htm
into a new module (if you don't already have it), and then add this
function to print, instead of open, a file:
'----- start of code -----
Function fPrintFile(stFile As String)
' This function uses ShellExecute to print, rather than
' open, the file.
Dim lRet As Long, varTaskID As Variant
Dim stRet As String
lRet = apiShellExecute(hWndAccessApp, "print", _
stFile, vbNullString, vbNullString, 0&)
If lRet > ERROR_SUCCESS Then
stRet = vbNullString
lRet = -1
Else
Select Case lRet
Case ERROR_NO_ASSOC:
stRet = "Error: No associated application. Couldn't
print!"
Case ERROR_OUT_OF_MEM:
stRet = "Error: Out of Memory/Resources. Couldn't
print!"
Case ERROR_FILE_NOT_FOUND:
stRet = "Error: File not found. Couldn't print!"
Case ERROR_PATH_NOT_FOUND:
stRet = "Error: Path not found. Couldn't print!"
Case ERROR_BAD_FORMAT:
stRet = "Error: Bad File Format. Couldn't print!"
Case Else:
End Select
End If
fPrintFile = lRet & _
IIf(stRet = "", vbNullString, ", " & stRet)
End Function
'----- end of code -----