Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Use VBScript in aspx page

Reply
Thread Tools

Use VBScript in aspx page

 
 
David C
Guest
Posts: n/a
 
      09-18-2007
Can I use VBScript in a aspx page similar to using Javascript for running
client code? I assume it would be used in a <script> block. This is for a
controlled intranet internal application and I'd like to be able to use Word
objects using CreateObject() etc. Is that possible, and if so, where can I
find more info on it? Thanks.

David


 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      09-18-2007
"David C" <(E-Mail Removed)> wrote in message
news:OJx9E3i%(E-Mail Removed)...

> Can I use VBScript in a aspx page similar to using Javascript for running
> client code?


Yes.

> I assume it would be used in a <script> block.


Yes.

> This is for a controlled intranet internal application and I'd like to be
> able to use Word objects using CreateObject() etc.


OK. Obviously, client-side VBScript runs only in IE - not a problem if you
control the browser, I guess...

Also, there's nothing you can do in VBScript as regards client-side Office
automation that you can't do just as well in JavaScript...

http://www.google.co.uk/search?sourc...+ActiveXObject


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
 
 
 
David C
Guest
Posts: n/a
 
      09-18-2007
Mark,
I tried this using the sample function below and got the error "Automation
server can't create object"

function openWord( file ) {
var oword = new ActiveXObject("Word.Application");
if( oword!==null ) {
oword.Visible = true;
oword.Documents.Open( file );
}
}

David
"Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
news:OYr5fGj%(E-Mail Removed)...
> "David C" <(E-Mail Removed)> wrote in message
> news:OJx9E3i%(E-Mail Removed)...
>
>> Can I use VBScript in a aspx page similar to using Javascript for running
>> client code?

>
> Yes.
>
>> I assume it would be used in a <script> block.

>
> Yes.
>
>> This is for a controlled intranet internal application and I'd like to be
>> able to use Word objects using CreateObject() etc.

>
> OK. Obviously, client-side VBScript runs only in IE - not a problem if you
> control the browser, I guess...
>
> Also, there's nothing you can do in VBScript as regards client-side Office
> automation that you can't do just as well in JavaScript...
>
> http://www.google.co.uk/search?sourc...+ActiveXObject
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net



 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      09-18-2007
"David C" <(E-Mail Removed)> wrote in message
news:e50IHhj%(E-Mail Removed)...

> I tried this using the sample function below and got the error "Automation
> server can't create object"
>
> function openWord( file ) {
> var oword = new ActiveXObject("Word.Application");
> if( oword!==null ) {
> oword.Visible = true;
> oword.Documents.Open( file );
> }
> }


That's almost certainly down to your browser's security settings, which
you'll need to ramp right down - incidentally, you'd get exactly the same
error in VBScript...

I strongly advise you not to do this...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
David C
Guest
Posts: n/a
 
      09-18-2007
So what are my alternatives? My customer wants to be able to open a Word
document or template and fill in data from their web page.

David
"Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
news:OsEO4yj%(E-Mail Removed)...
> "David C" <(E-Mail Removed)> wrote in message
> news:e50IHhj%(E-Mail Removed)...
>
>> I tried this using the sample function below and got the error
>> "Automation server can't create object"
>>
>> function openWord( file ) {
>> var oword = new ActiveXObject("Word.Application");
>> if( oword!==null ) {
>> oword.Visible = true;
>> oword.Documents.Open( file );
>> }
>> }

>
> That's almost certainly down to your browser's security settings, which
> you'll need to ramp right down - incidentally, you'd get exactly the same
> error in VBScript...
>
> I strongly advise you not to do this...
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net



 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      09-18-2007
"David C" <(E-Mail Removed)> wrote in message
news:OA959Ok%(E-Mail Removed)...

> So what are my alternatives? My customer wants to be able to open a Word
> document or template and fill in data from their web page.


It's important to realise (and educate your client!) that one of the
fundamental design goals of web browsers is specifically to prevent *any*
sort of automatic interface with the hardware of the client machine and any
software installed on it, for fairly obvious security reasons...

Why not simply get the users to fill in all the details in your web page and
then create a Word document server-side using HTML, OpenXML or Aspose and
then stream it down to them?

What is the actual requirements here...?


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
David C
Guest
Posts: n/a
 
      09-19-2007
We are replacing an Access application with a web/SQL Server application.
One of the things done in Access is OLE automation doing data inserts into a
Word document (new and templates), possibly modifying the document text and
then saving/printing the letter.

David
"Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
news:eZMVCwk%(E-Mail Removed)...
> "David C" <(E-Mail Removed)> wrote in message
> news:OA959Ok%(E-Mail Removed)...
>
>> So what are my alternatives? My customer wants to be able to open a Word
>> document or template and fill in data from their web page.

>
> It's important to realise (and educate your client!) that one of the
> fundamental design goals of web browsers is specifically to prevent *any*
> sort of automatic interface with the hardware of the client machine and
> any software installed on it, for fairly obvious security reasons...
>
> Why not simply get the users to fill in all the details in your web page
> and then create a Word document server-side using HTML, OpenXML or Aspose
> and then stream it down to them?
>
> What is the actual requirements here...?
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net



 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      09-19-2007
"David C" <(E-Mail Removed)> wrote in message
news:Oskye1r%(E-Mail Removed)...

> "Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
> news:eZMVCwk%(E-Mail Removed)...
>> "David C" <(E-Mail Removed)> wrote in message
>> news:OA959Ok%(E-Mail Removed)...
>>
>>> So what are my alternatives? My customer wants to be able to open a
>>> Word document or template and fill in data from their web page.

>>
>> It's important to realise (and educate your client!) that one of the
>> fundamental design goals of web browsers is specifically to prevent *any*
>> sort of automatic interface with the hardware of the client machine and
>> any software installed on it, for fairly obvious security reasons...
>>
>> Why not simply get the users to fill in all the details in your web page
>> and then create a Word document server-side using HTML, OpenXML or Aspose
>> and then stream it down to them?
>>
>> What is the actual requirements here...?

>
> We are replacing an Access application with a web/SQL Server application.
> One of the things done in Access is OLE automation doing data inserts into
> a Word document (new and templates), possibly modifying the document text
> and then saving/printing the letter.


Access is a desktop application, same as Word is a desktop application.

ASP.NET isn't - it's as simple as that...

By far the simplest solution here would be to create the Word documents on
the server as I described, and then stream them down to the client either
directly in the browser or as files which they can save wherever they want
to save them and then edit them as they see fit.

Alternatively, you can save the documents on a network file server and then
provide a hyperlink for the users to click.


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
launch an exe file from a web page...I use jsp and i cannot use VBScript... dinamointer Javascript 5 05-12-2006 05:46 PM
Loading an aspx page in a fram from another aspx page =?Utf-8?B?Uk1M?= ASP .Net 1 09-16-2005 01:21 PM
adding main.aspx.vb & main.aspx.resx under aspx John M ASP .Net 1 05-29-2005 09:27 PM
How to Pass values between from a popup page aspx & a normal page aspx Marco Antonio Montalvo Durán ASP .Net 2 01-23-2004 09:35 PM
How do I post data from aspx page to another aspx page. Sriram Mallajyosula ASP .Net 1 11-05-2003 04:48 PM



Advertisments