Quote:
Originally Posted by fumei
You do not want to get orphaned sessions in the first place. Word rarely ever needs multiple instances, as it is very robust and can handle many documents in one session.
|
Fumei,
I agree with you. My code runs ok the first time everytime from Excel. But when I run it a first time, and do another run then I get that
Run-Time Error '462': The remote server machine does not exist or is unavailable. I have qualified the variables as I described in my earlier post. Macropod also gave me very insightful tips but I am still getting the error after a back-to-back run.
I even Dimmed all the Word objects in the Option Explicit section, and set them in the main code. That even enabled me to qualify Activedocument with Wrddoc.Application.Activedocument and so on but I still got the error. I also added wrdApp.Quit at the end of my code.. same problem.
Maybe, if I breakdown my process
(assuming I am starting from scratch), you can look at it from a different coding technique.
Assume In Excel, Range("A:B") contains data.
I want to create a word document, then load the data from Excel in succession. That is Range("A1").value in Excel will be in 1st paragraph of Word, B1.value in 2nd Word paragraph, A2 in 3rd para, B2 in 4th para and so on...
There will be only 2 bulletting styles for the paragraphs:
Paragraphs 1, 3, 5, 7, etc should have this style applied:
Bullet ChrW(61623). NOTE: Bullet should be on/or closest to page margin but distance between the bullet and the paragraph should be about 0.5 inch. Also, the paragraph font.bold = true.
Paragraphs 2, 4, 6, 8, etc should have this style applied:
Hollow circle bullet "O" . NOTE: Bullet should be 1 inch from page margin but distance between the bullet and the paragraph should be about 0.5 inch. Also the paragraph font.bold = false
That is the entire problem in a nutshell. Macropod, used his approach because I had already successfully loaded the data into Word and was struggling with the bulltting. However, I am not sure if bulletting as the data are entered into the Word will be more efficient...
If you can also look at it differently from how I have described the problem I'd appreciate it.
Thanks!
Jay