Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VBScript Word document code works server side but not client side

Posted on 2006-07-18
4
Medium Priority
?
1,005 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 1000 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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

972 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