DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub Evn()
Dim i As Integer, WShel As Object, a As String
Set WShel = CreateObject("WScript.Shell")
a = WShel.SpecialFolders("Desktop")
Const MsgText = "Dosyalar İndirilsin mi ?"
Const MsgHdr = "İnidiriliyor..."
If MsgBox(MsgText, vbYesNo Or vbMsgBoxRtlReading Or vbExclamation, _
MsgHdr) = vbYes Then
MkDir (a & "\Evn Download")
URL$ = UserForm1.WebBrowser1.LocationURL
dosya$ = a & "\Evn Download" & "\DENEME.PDF"
DownloadFile URL$, dosya$
End If
i = Empty: a = vbNullString: Set WShel = Nothing
End Sub
Function DownloadFile(ByVal URL$, ByVal LocalPath$) As Boolean
Dim XMLHTTP, ADOStream, FileName
On Error Resume Next: Kill LocalPath$
Set XMLHTTP = CreateObject("Microsoft.XMLHTTP")
XMLHTTP.Open "GET", Replace(URL$, "\", "/"), "False"
XMLHTTP.send
If XMLHTTP.StatusText = "OK" Then
Set ADOStream = CreateObject("ADODB.Stream")
ADOStream.Type = 1: ADOStream.Open
ADOStream.Write XMLHTTP.responseBody
ADOStream.SaveToFile LocalPath$, 2
ADOStream.Close: Set ADOStream = Nothing
DownloadFile = True
Else
MsgBox "Bağlantı sağlanamadı", vbInformation, "Hata !"
End If
Set XMLHTTP = Nothing
End Function
Private Sub CommandButton1_Click()
Call Evn
End Sub
Private Sub UserForm_Activate()
WebBrowser1.Navigate "Buraya pdf adresini yazın"
End Sub
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Private Sub CommandButton2_Click()
Dim strPath As String
Dim strURL As String
strPath = "D:\indirilen.pdf"
strURL = Me.WebBrowser1.LocationURL
URLDownloadToFile 0&, strURL, strPath, 0&, 0&
End Sub