Use VBScript in aspx page

Discussion in 'ASP .Net' started by David C, Sep 18, 2007.

  1. David C

    David C Guest

    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
    David C, Sep 18, 2007
    #1
    1. Advertising

  2. "David C" <> wrote in message
    news:OJx9E3i%...

    > 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?sour...-GBGB220GB220&q=JavaScript Word ActiveXObject


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
    Mark Rae [MVP], Sep 18, 2007
    #2
    1. Advertising

  3. David C

    David C Guest

    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]" <> wrote in message
    news:OYr5fGj%...
    > "David C" <> wrote in message
    > news:OJx9E3i%...
    >
    >> 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?sour...-GBGB220GB220&q=JavaScript Word ActiveXObject
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
    David C, Sep 18, 2007
    #3
  4. "David C" <> wrote in message
    news:e50IHhj%...

    > 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
    Mark Rae [MVP], Sep 18, 2007
    #4
  5. David C

    David C Guest

    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]" <> wrote in message
    news:OsEO4yj%...
    > "David C" <> wrote in message
    > news:e50IHhj%...
    >
    >> 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
    David C, Sep 18, 2007
    #5
  6. "David C" <> wrote in message
    news:OA959Ok%...

    > 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
    Mark Rae [MVP], Sep 19, 2007
    #6
  7. David C

    David C Guest

    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]" <> wrote in message
    news:eZMVCwk%...
    > "David C" <> wrote in message
    > news:OA959Ok%...
    >
    >> 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
    David C, Sep 19, 2007
    #7
  8. "David C" <> wrote in message
    news:Oskye1r%...

    > "Mark Rae [MVP]" <> wrote in message
    > news:eZMVCwk%...
    >> "David C" <> wrote in message
    >> news:OA959Ok%...
    >>
    >>> 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
    Mark Rae [MVP], Sep 19, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sriram Mallajyosula

    How do I post data from aspx page to another aspx page.

    Sriram Mallajyosula, Nov 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    970
    Steve C. Orr [MVP, MCSD]
    Nov 5, 2003
  2. Marco Antonio Montalvo Durán
    Replies:
    2
    Views:
    4,094
    Matt Morris
    Jan 23, 2004
  3. John M
    Replies:
    1
    Views:
    1,129
    Kumar Reddi
    May 29, 2005
  4. =?Utf-8?B?Uk1M?=
    Replies:
    1
    Views:
    544
    =?Utf-8?B?QW5keSBMdWtzaWM=?=
    Sep 16, 2005
  5. dinamointer
    Replies:
    5
    Views:
    257
    Randy Webb
    May 12, 2006
Loading...

Share This Page