Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Word Modification

Status
Not open for further replies.

ufobaby

MIS
Sep 25, 2001
238
US
Dear all,

i have word templates i.e word do with empty tables etc ....
1. want to use ASP to populate them
2. and then save the file on the server
3. give a link to the user for that file

am using the following in the ASP page but it gives an error "Expected Statement" pls help ....
Code:
WRD.Selection.GoTo what:=wdLine, which:=wdGoToAbsolute, Count:=1
WRD.Selection.GoTo what:=wdGoToTable, which:=wdGoToAbsolute, Count:=1

where "WRD" is Set WRD = Server.Createobject("Word.application")

Pls help



__________
[cheers]
Niraj...
"The unexpected success is not just an opportunity for innovation. It demands innovation."
[noevil]
 
Hello ufobaby,

First thing to do is to make it positional. Then, if you want to keep named constants in place, define them explicitly or through some included file.
Code:
const wdGoToLine=3
const wdGoToTable=2
const wdGoToAbsolute=1
dim icount : icount=-1
WRD.Selection.GoTo wdLine, wdGoToAbsolute, icount
WRD.Selection.GoTo wdGoToTable, wdGoToAbsolute, icount
regards - tsuji
 
Correction:

An obvious typo:
[tt]dim icount : icount=[red]1[/red][/tt]

- tsuji
 
tsuji,
thanks for the response,

but i guess the wdLine is some parameter defined for the GoTo function in MS Word. creating constants will not help... nevertheless i tried the same


now for some odd reason it gives and error

ASP 1077

Server.CreateObject Failed

Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at:

__________
[cheers]
Niraj...
"The unexpected success is not just an opportunity for innovation. It demands innovation."
[noevil]
 
Where are you trying to tell it to go?
It looks like you want it to go to the next line?

Try:

WRD.Selection.GoToNext wdGoToLine '3
WRD.Selection.TypeText vbCrLf


- J
 
ufobaby,

That is my sloppy mistake. I should list wdLine instead of wdGoToLine! according to your original script. Sorry. The constant should therefore be explicited for it:

[tt] const wdLine=5[/tt]

- tsuji
 
will list down very specific steps am trying ti achieve.

1.Open the Word document
2. Goto the First line
3. From there go to the first Table
4. start inserting data in the Table Cell one after another
5. Save and close the file
6. give the user a link of file on the server.

but now the "Server.CreateObject itself is generating error the one mentioned in the previous post "Error 1077"

pls pls pls help .... this is got the whole project stuck

__________
[cheers]
Niraj...
"The unexpected success is not just an opportunity for innovation. It demands innovation."
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top