Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Please Help!
I have an auto search engine submission program. Here is one section of my
code:

Private Function SubmitDMOZ(url As String, email As String, title As String,
desc As String) As Boolean
Dim NavUrl As String


Me.RtfStatus.SelStart = Len(Me.RtfStatus.Text)
Me.RtfStatus.SelColor = vbBlack
Me.RtfStatus.SelText = vbNewLine & "Submitting " & Trim(url) & " to Open
Directory"

NavUrl =
"http://dmoz.org/cgi-bin/add.cgi?where=Regional/North_America/United_States/
Ohio/Business_and_Economy/Real_Estate"


Me.wbbrowser.Navigate NavUrl
Do
DoEvents
Loop While wbbrowser.Busy

Me.wbbrowser.Document.All("url").Value = Trim(url)
Me.wbbrowser.Document.All("title").Value = Trim(title)
Me.wbbrowser.Document.All("description").Value = Trim(desc)
Me.wbbrowser.Document.All("email").Value = Trim(email)
Me.wbbrowser.Document.All("submit")(1).Click
Do
DoEvents
Loop While wbbrowser.Busy

If wbtitle = "Submission Received" Then
SubmitDMOZ = True
Else
SubmitDMOZ = False
End If


End Function
---------------------

At  the Me.wbbrowser.Document.All("url").Value = Trim(url) I get the
following error:

With block not set


Report this thread to moderator Post Follow-up to this message
Old Post
Erica
09-30-04 08:55 PM


Re: Please Help!
Erica wrote:
> I have an auto search engine submission program. Here is one section
> of my code:
>
> Private Function SubmitDMOZ(url As String, email As String, title As
> String, desc As String) As Boolean
>     Dim NavUrl As String
>
>
>     Me.RtfStatus.SelStart = Len(Me.RtfStatus.Text)
>     Me.RtfStatus.SelColor = vbBlack
>     Me.RtfStatus.SelText = vbNewLine & "Submitting " & Trim(url) & "
> to Open Directory"
>
>     NavUrl =
>
"http://dmoz.org/cgi-bin/add.cgi?where=Regional/North_America/United_States/
Ohio/Business_and_Economy/Real_Estate"
>
>
>     Me.wbbrowser.Navigate NavUrl
>     Do
>         DoEvents
>     Loop While wbbrowser.Busy
>
>     Me.wbbrowser.Document.All("url").Value = Trim(url)
>     Me.wbbrowser.Document.All("title").Value = Trim(title)
>     Me.wbbrowser.Document.All("description").Value = Trim(desc)
>     Me.wbbrowser.Document.All("email").Value = Trim(email)
>     Me.wbbrowser.Document.All("submit")(1).Click
>     Do
>         DoEvents
>     Loop While wbbrowser.Busy
>
>     If wbtitle = "Submission Received" Then
>         SubmitDMOZ = True
>     Else
>         SubmitDMOZ = False
>     End If
>
>
> End Function
> ---------------------
>
> At  the Me.wbbrowser.Document.All("url").Value = Trim(url) I get the
> following error:
>
> With block not set

Hi Erica,

I've tried your code in a test project (added a RichTextBox, a WebBrowser
and a CommandButton), and it seems to be working - somehow, if I declare the
wbtitle variable. Other than that, I'd made only minor, non-essential
adjustments.

Here's the modified code - it really shows the web page, then receives an
"incomplete data submitted" response.

'---------------------------------------------------------
Option Explicit: DefObj A-Z

Private Function SubmitDMOZ( _
url As String, email As String, _
title As String, desc As String _
) As Boolean

Dim NavUrl          As String
Dim wbtitle         As String      ' ***FORMALLY***

On Error GoTo ErrHandler

With RtfStatus
.SelStart = Len(Me.RtfStatus.Text)
.SelColor = vbBlack
.SelText = vbNewLine & "Submitting " & Trim(url) & " to Open
Directory "
End With

NavUrl = _

"http://dmoz.org/cgi-bin/add.cgi?where=Regional/North_America/United_States/
Ohio/Business_and_Economy/Real_Estate"


With wbbrowser
.Navigate NavUrl
Do
DoEvents
Loop While .Busy

With .Document.All
.Item("url").Value = Trim$(url)
.Item("title").Value = Trim$(title)
.Item("description").Value = Trim$(desc)
.Item("email").Value = Trim$(email)
.Item("submit")(1).Click
End With
Do
DoEvents
Loop While .Busy
End With

If wbtitle = "Submission Received" Then   ' ***???***
SubmitDMOZ = True
End If
Exit Function

ErrHandler:
Beep
With Err
Debug.Print "***Unexpected error*** : " & _
.Number & " (&H" & Hex$(.Number) & ")" & vbNewLine & _
vbNewLine & "   Source : " & .Source & _
vbNewLine & "   Descr : " & .Description
End With
End Function

Private Sub cmdGo_Click()
If SubmitDMOZ("", "", "", "") Then
Debug.Print "*OK*"
Else
Debug.Print "***Failed***"
End If
End Sub

'---------------------------------------------------------

hth
--
PZ



Report this thread to moderator Post Follow-up to this message
Old Post
Pásztor, Zoltán
09-30-04 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Basic archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:42 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.