PDA

View Full Version : Word to Excel to Word



Quinn
05-02-2006, 09:11 AM
I am using Word VBA to get information from a document,
then open an instance of Excel, and then add more information,
then create a new Word document that is a seriers of tables.
I use this code to open the Excel:
open new Excel workbook
On Error Resume Next
Set XlApp = GetObject(, "Excel.Application")
If XlApp Is Nothing Then
Set XlApp = CreateObject("Excel.Application")
If XlApp Is Nothing Then
MsgBox "Could not start Excel"
End
End If
End If

which seems to work, although when I close Excel it keeps a version somewhere in memory, and will use the old version, even after I modify the code somewhat. How do I get rid of that old Excel?




2nd) as I wrote above I am going Word=> Excel => Word
I have a form for the first instance of Word. How do I keep that form and have it appear in the Excel spreadsheet?
Thanks
Quinn

TonyJollans
05-02-2006, 12:21 PM
Hi Quinn,

You don't say how you close Excel which is probably the root of your first problem.


I have a form for the first instance of Word.You're not using two separate instances of Word, are you?

I think you will find it difficult using the same form (you do mean UserForm (designed in the VBE), I take it) in both Excel and Word. Can you give a bit more detail as to why you want to do this?

Quinn
05-03-2006, 01:13 PM
I'm using the AppXls.Quit method after I do a series of loops.
Is that adequate? I do not see any running instances of Excel in the
Task Manager. However, when I shut down the computer, it will ask me
if I want to save Book1, Book2, etc...making me believe that the Excel
is still in memory.
No, I am using only one instance of word.

Our team leader likes having the form. The original document is several hundred pages, I need to get the Tables and Figures and transfer that data to an Excel spreadsheet for the other team members. (I do this by cut and paste now!). Then data is added to the Excel sheet, and from
that many tables are created for our medical writers to use.
Thanks!