okcuser
asked on
VBScript Word document code works server side but not client side
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.Applica tion")
objWord.Visible = true
Set WordDoc = objWord.Documents.Add("\\o kctonerweb 1\WebTempl ates\Incid entExportW ord_new.do t")
With WordDoc
.Tables(1).Cell(1, 1).Range.InsertAfter ("Test")
End With
</SCRIPT>
<SCRIPT LANGUAGE=VBScript>
Set objWord = CreateObject("Word.Applica
objWord.Visible = true
Set WordDoc = objWord.Documents.Add("\\o
With WordDoc
.Tables(1).Cell(1, 1).Range.InsertAfter ("Test")
End With
</SCRIPT>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
ASKER
Got it
<script language=vbscript>
myvar=<%=request.querystri ng("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!
<script language=vbscript>
myvar=<%=request.querystri
...
</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!
ASKER