Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to execute a small vb script file, for that I wrote the following code in the notepad and saved that notepad file as

"sampleScript.vbs" is that correct? please note the code that I have written. folowing error occured please help me

Error coming : Expected statement missing

Sourece: Vb complilation error

line : 1

Code
-------
XML
<html>
<body>
<script type="text/vbscript">
document.write("Hello World")
</script>
</body>
</html>
Posted
Updated 9-Aug-11 21:42pm
v2

This is not VBScript, not even close. It's HTML, with some VBScript that can only be viewed in a browser ( document.write is not VBScript per se, it relies on a document object existing, which is only true in a browser ). Save this as .htm and I believe IE will render it correctly. Any other browser will not, only IE can use VBScript. If you want to do scripting in a web page, then javascript is the way to go.
 
Share this answer
 
Comments
Ajain A K 10-Aug-11 4:31am    
Dear christian,

Thank you so much for the instant help from you that was fine answer. I am using Internet Explorer only. I want to ask an advice to you plese direct me

My requirment is that I want to do some programming for MS-Excel manipulation using vb script is that possible?

my exact requirment are:

1. I want to plot some graphs based on excel data input

2. I want to write some datas in excel cells

is that possible? please advice me.... if you can provide me some tutorials for that
As Christian already pointed out, your VBScript is embedded inside an HTML page, hence the correct file extension for your file is html (and, yes, you have to open it with Internet Explorer, other browsers like Firefox or Chrome don't support VBScript).
Even the tutorial from which you grabbed the code[^] is clear about.
On the other hand, if you wan't to create a 'stand-alone' VBScript, then the following line is just enough:

VBScript
MsgBox "Hello World"


save it as "hello.vbs" and double click to run (be sure to do it on a Windows machine).
 
Share this answer
 
v3
Comments
Ajain A K 10-Aug-11 4:32am    
Dear Pallini,

Thank you so much for the instant help from you that was fine answer. I am using Internet Explorer only. I want to ask an advice to you plese direct me

My requirment is that I want to do some programming for MS-Excel manipulation using vb script is that possible? my exact requirment

are:

1. I want to plot some graphs based on excel data input

2. I want to write some datas in excel cells

is that possible? please advice me.... if you can provide me some tutorials for that
CPallini 10-Aug-11 5:12am    
Google is you best friend, search for "Excel Automation with VBScript", I found, for instance:
http://knol.google.com/k/excel-vbscript-automation#
Ajain A K 10-Aug-11 8:22am    
Hi Pallini,

Thanks a lot, the link that you provided is very useful for excel automation.
CPallini 10-Aug-11 8:24am    
You are welcome.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900