|
Напечатать Web-страницу |
|
|
Требуется Интернет Эксплорер версии 4 и выше.
Перед началом печати будет показан диалог
печати.
Добавьте элемент CommandButton. Private Const MAX_PATH = 255
Private Declare Function GetSystemDirectory Lib "kernel32" Alias
"GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Function PrintWebPage(ByVal URL As String) As Boolean
Dim sFile As String
sFile = SystemDir & "\MSHTML.DLL"
If Dir(sFile) = "" Then Exit Function
On Error Resume Next
Shell "rundll32.exe " & sFile & ",PrintHTML " & URL,
vbNormalFocus
PrintWebPage = Err.Number = 0
End Function
Private Function SystemDir() As String
Dim sRet As String, lngRet As Long
sRet = String$(MAX_PATH, 0)
lngRet = GetSystemDirectory(sRet, MAX_PATH)
SystemDir = Left(sRet, lngRet)
End Function
Private Sub Command1_Click()
PrintWebPage "http://vbnet.ru"
End Sub
|
|
|
|
|
|
|