Solved

VBScript Word document code works server side but not client side

Posted on 2006-07-18
4
1,003 Views
Last Modified: 2012-06-27
I have code the opens a word document from a template and populates some tables.  It works great if I run it on the web server, save the file, and email it to the client then delete the file (so they don't stack up on the server).  I would rather just open the document on the clients workstation (they all have word), populate it,  and let them save it where they want.  I found that changing my <% %> to <script language=vbscript></script> causes the word document to open on the client like I want.  The template opens, but it won't insert the text into the table.  Why does the exact same code work on the server, but not the client?

<SCRIPT LANGUAGE=VBScript>
Set objWord = CreateObject("Word.Application")  
objWord.Visible = true
Set WordDoc = objWord.Documents.Add("\\okctonerweb1\WebTemplates\IncidentExportWord_new.dot")

With WordDoc
.Tables(1).Cell(1, 1).Range.InsertAfter ("Test")
End With
</SCRIPT>
0
Comment
Question by:okcuser
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 15

Accepted Solution

by:
joeposter649 earned 250 total points
ID: 17130724
Yeah, you don't want to open word on the server...
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757

Unless you're willing to spend some money on something like softartisans' officewriter you probably want to do something like this...
http://support.microsoft.com/kb/270906/

0
 

Author Comment

by:okcuser
ID: 17131047
I understand the reasons for the server side, but is there a reason that it shouldn't be done on the client side?  This is a controlled internal application where all the users have word.  They need to be able to edit it in word when necessary.  For the most part they use the printable reports off the web application.  I just am not sure why the .tables code works for server side, but not client side.   Seems like if word is on both the server and the client it should work the same?
0
 

Author Comment

by:okcuser
ID: 17131210
Well, it looks like the problem isn't my tables code, but instead that I am trying to read querystring variables just above it.  So I guess my next question to ask will be how to get request.querystring variables into my client side vbscript.  
0
 

Author Comment

by:okcuser
ID: 17131248
Got it

<script language=vbscript>
myvar=<%=request.querystring("myvar")%>

...
</script>

I'd still be curious to know if there is a reason why the automation shouldn't be done on the client side.  Thanks for taking the time to help!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question