Solved

VBScript Word document code works server side but not client side

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

864 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

22 Experts available now in Live!

Get 1:1 Help Now