Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7546277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:09:28+00:00 2026-05-30T09:09:28+00:00

I’m new to vbscript. I get the error Declaration expected at get_html At the

  • 0

I’m new to vbscript. I get the error

Declaration expected at get_html

At the bottom part of my code. I am actually trying to declare a value (which is a url) for the variable get_html. How can I resolve this?

Module Module1

Sub Main()

End Sub
Sub get_html(ByVal up_http, ByVal down_http)
    Dim xmlhttp : xmlhttp = CreateObject("msxml2.xmlhttp.3.0")
    xmlhttp.open("get", up_http, False)
    xmlhttp.send()

    Dim fso : fso = CreateObject("scripting.filesystemobject")

    Dim newfile : newfile = fso.createtextfile(down_http, True)
    newfile.write(xmlhttp.responseText)

    newfile.close()

    newfile = Nothing
    xmlhttp = Nothing

End Sub
get_html _"http://www.somwwebsite.com", _"c:\downloads\website.html"

End Module
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:09:29+00:00Added an answer on May 30, 2026 at 9:09 am

    There are some syntax mistakes.

    • Module statement is not part of VBScript.
    • Underscores can lead to unexpected results. See http://technet.microsoft.com/en-us/library/ee198844.aspx (search for the word underscore on page)
    • You can’t use parentheses when calling a Sub (e.g. xmlhttp.open is a sub, does not return anything). You have two main alternatives to calling a sub routine. sub_proc param1, param2 or Call sub_proc(param1, param2)
    • The assignment operator ‘=‘ is not enough for the objects. You should
      use Set statement. It assigns object references to the
      variables.

    The response may be return as utf-8 encoded. But however FSO is not at peace with utf-8. Another option is to write the response as unicode (passing True as third parameter to CreateTextFile)
    but the output size will be larger than it should be. Therefore I would prefer to use Stream object.
    I’ve revised your code. Please consider.

    'Requeired Constants
    Const adSaveCreateNotExist = 1 'only creates if not exists
    Const adSaveCreateOverWrite = 2 'overwrites or creates if not exists
    Const adTypeBinary = 1
    
    Sub get_html(ByVal up_http, ByVal down_http)
        Dim xmlhttp, varBody
        Set xmlhttp = CreateObject("msxml2.xmlhttp.3.0")
            xmlhttp.open "GET", up_http, False
            xmlhttp.send
            varBody = xmlhttp.responseBody
        Set xmlhttp = Nothing
        Dim str
        Set str = CreateObject("Adodb.Stream")
            str.Type = adTypeBinary
            str.Open
            str.Write varBody
            str.SaveToFile down_http, adSaveCreateOverWrite
            str.Close
        Set str = Nothing
    End Sub
    
    get_html "http://stackoverflow.com", "c:\downloads\website.html"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.