PDA

View Full Version : Write To Web Page



websailor
05-19-2008, 08:28 AM
hi,

please see this code first:




Option Explicit
' Add a reference to Microsoft WinHTTP Services
Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0


Public Sub WriteToWebsite()
Dim MyCon As New WinHttpRequest
Dim SendAuthor As String
Dim SendMessage As String

'variable to send
SendAuthor = Sheet1.Range("B3").Value
SendMessage = Sheet1.Range("B6").Value

If SendAuthor = "" Or SendMessage = "" Then
MsgBox "Enter Author and Message"
Exit Sub
End If

'Connection string to send
MyCon.Open "GET", _
"http://www.yoursite.com/get.php" & _
"?GetAuthor=" & SendAuthor & _
"&GetMessage=" & SendMessage

'send it
MyCon.Send

'clear contents
Sheet1.Range("B3").ClearContents
Sheet1.Range("B6").ClearContents
End Sub

Public Sub GoThere()
Dim newsite As Object

Set newsite = CreateObject("InternetExplorer.application")
newsite.Visible = True
newsite.Navigate _
"http://www.yoursite.com/display.php"

End Sub




this code use 2 cells to send it to web site page,

the quistion is: what should i add or change to make it use several cells to send theme to the page ?

from example:

i want send cell A1 AND C3 AND BA1 and so and so etc...

any help

malik641
05-19-2008, 08:11 PM
I'm no expert on this, but isn't just as easy as:
"?GetAuthor=" & Range("A1").Value & "+" & Range("A2").Value & ' ...
Just adding a "+" to make it say "and/or" in the request? I'm not sure that's how it works, but you could try.