Log in

View Full Version : Write cookie to cookies folder



fb7894
07-13-2016, 06:27 AM
I'm struggling to find VBA code that will create a cookie file in my windows cookie folder (C:\Users\username\AppData\Roaming\Microsoft\Windows\Cookies)

Thanks in advance.

mancubus
07-13-2016, 11:04 PM
i am not familiar with the requirement.

just googled and found this.



Sub test()

Dim t As String

With CreateObject("MSXML2.XMLHTTP")
.Open "get", "http://www.comparity.net/perl/form.pl", False
.setRequestHeader "Cookie", "one=foo;two=bar;"
.setRequestHeader "Cookie", "one=foo;two=bar;"
.send
t = .responseText
WriteTextFile "z:\test.html", t
Debug.Print .Status
Debug.Print t
End With

End Sub



Sub WriteTextFile(FileName, Text)

Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim fs, f

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(FileName, ForWriting, -2)
f.Write Text
f.Close

End Sub


from
http://objectmix.com/xml-soap/86831-excel-vba-xmthttp-cookies.html

this may be get you started.
good luck.