Solved

VBScript Word document code works server side but not client side

Posted on 2006-07-18
4
994 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
  • 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Xsl Nested Loop 4 21
Disabling automatic web page translations 9 31
xml attribute DTD attribute differences 3 58
ColdFusion Rereplace 3 62
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…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now