Click here to Skip to main content
11,706,979 members (52,278 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VBScript
Hi,

I am beginer in VB scripting, I tried to use a hello world program in VB but it gives compilation error somebody please help me how to solve this problem.


I use following code

I written this code in notepade and saved as Hello.vbs

<html>
<body>
<script type="text/vbscript">
document.write("Hello World")
</script>
</body>
</html>
Posted 7-Nov-11 21:42pm
Edited 7-Nov-11 21:46pm
Mehdi Gholam285.2K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This script will only run under IE not as a ".vbs" file.

See here:
http://www.w3schools.com/vbscript/default.asp[^]
  Permalink  
Comments
Ajain A K at 8-Nov-11 4:17am
   
Hi Mehdi,

Thanks a lot for the quick response.

I am using only one browser in my PC that is Internet Explorer.

please note this URL

http://www.tizag.com/vbscriptTutorial/vbscriptfirstscript.php

please share if you find any other alternative
thatraja at 8-Nov-11 7:19am
   
5!
Mehdi Gholam at 8-Nov-11 7:27am
   
Cheers
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

open a notepad & write the following line:

msgbox("Hello World")

save it as Hello.vbs, when you double click, this will display the alert box.

check the following VB script tutorial

http://www.w3schools.com/vbscript/default.asp[^]
  Permalink  
Comments
Mehdi Gholam at 8-Nov-11 3:51am
   
5'ed
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Mehdi is right, It'll work only in IE.
Wiki[^] says:
However, other web browsers such as Firefox and Opera do not have built-in support for VBScript. This means that where client-side scripting and cross-browser compatibility are required, developers usually choose JavaScript over VBScript.
For details about the particular Error number, see this
Code Error 800A0400 - Expected Statement[^]
  Permalink  
Comments
Ajain A K at 8-Nov-11 4:36am
   
Hi thatraja,

Thanks a lot for the comment, I understand what Mehadi is saying. I am not using any other browser, I am trying with only IE
thatraja at 8-Nov-11 4:38am
   
OK then check the link(error-solution) in my answer.
Mehdi Gholam at 8-Nov-11 7:27am
   
5'ed

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 140
1 OriginalGriff 125
2 chainerlt 110
3 ppolymorphe 99
4 Mika Wendelius 70
0 OriginalGriff 9,178
1 Sergey Alexandrovich Kryukov 8,487
2 CPallini 5,189
3 Maciej Los 4,766
4 Mika Wendelius 3,696


Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 8 Nov 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100