Tolong pilih kategori sesuai, jenis posting (diskusi atau bukan) dan sertakan tag/topik yang sesuai seperti komputer, java, php, mysql, dll. Promosi atau posting tidak pada tempatnya akan kami hapus!
- Bagi Anda yang ingin mendaftar, baca link berikut:
http://diskusiweb.com/discussion/50491/how-to-registrasi-diskusiweb-com-baca-ini-terlebih-dahulu
- Cara menyisipkan kode program supaya tampil rapi dan terformat dengan baik di diskusiweb.com: http://www.diskusiweb.com/discussion/50415/cara-menyisipkan-kode-program-di-diskusiweb-com
- Cara posting gambar/image di post Anda: http://www.diskusiweb.com/discussion/47345/cara-menyisipkan-menyertakan-image-pada-posting/p1

Makro Excel TDK jalan

edited December 5 in Seputar DiskusiWeb.com
Dear all bantuannya donk saya ada makro proses upload data txt di web tetapi tidak jalan
Makro di buat berdasarkan web source di bawah
Berikut makro dan web source ya

Sub UploadFile()
Dim sURL As String, sPath As String, sFile As String, sField As String, sHeader As String
Dim sBoundary As String, sFormData As String, sByteData As String
Dim bByte() As Byte
Dim xWB As Object
Dim lIdx As Long

sBoundary = "---------------------------123ABC456"
sURL = "https://bsdcasaps1prd.danamon.co.id:4444/LOSBDI/uploadSid.los"
sField = "sidTextFormFile"
sFile = "DATA0001.txt"
sPath = "D:\TEST\"

lIdx = FreeFile
ReDim bByte(FileLen(sPath & sFile) - 1)
Open sPath & sFile For Binary As lIdx
Get lIdx, , bByte
Close lIdx

sByteData = StrConv(bByte, vbUnicode)

sFormData = "--" + sBoundary + vbCrLf
sFormData = sFormData + "Content-Disposition: form-data; name=""" + sField + """;"
sFormData = sFormData + " filename=""" + sFile + """" + vbCrLf
sFormData = sFormData + "Content-Type: text/plain" + vbCrLf + vbCrLf
sFormData = sFormData + sByteData
sFormData = sFormData + vbCrLf + "--" + sBoundary + "--" + vbCrLf

ReDim bByte(Len(sFormData) - 1)
bByte = StrConv(sFormData, vbFromUnicode)

sHeader = "Content-Type: multipart/form-data; boundary=" + sBoundary + vbCrLf

Set xWB = CreateObject("InternetExplorer.Application")
With xWB
'+-- Baris yang ditandai berikut digunakan
'+-- untuk proses inspeksi saja. Hapus saja
'+-- jika sudah tidak digunakan.
.Visible = True '+-- 1.
.Navigate "about:blank" '+-- 2.
Stop '+-- 3. Tekan F5

.Navigate sURL, , , bByte, sHeader
Do While .Busy
DoEvents
Loop

Stop '+-- 4. Tekan F5.
.Quit
End With
Set xWB = Nothing

End Sub


Web source







Upload SID





















//FLAG TO CHECK A REQUEST IS SUBMITTED FOR PROCESSING

var requestProcessFlag="N";

function unlockApplication()

{

if(document.forms[0]){

if(document.forms[0].hidModifyFlag){ // 00.3.0.0.1 for bug no bug no 42 & 61 by narendra singh danu on 07/01/2205

if(document.forms[0].hidModifyFlag!=null && document.forms[0].hidModifyFlag.value != ""){

if(!confirm("Value for a field has changed.To commit the changes please press Save/Add/Update else press Cancel")){

return;

}

}

} // 00.3.0.0.1

}

top.window.close();

}







<!-- Commented by Nitin Bansal for displaying of Selected Data Only



-->



Unit

DI PERDANA UNSECURED



User

MY110823 



Tanggal hari ini

29/11/2018



 















Upload SID Screen





Data Mapping Text File

 





SID Text File

 





HTML File

 



<!-- Closing of Main Table -->





<!-- Closing of Form Tag -->
Tagged:
Sign In or Register to comment.