ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Paste in WinWord, problems with several processes (https://www.excelbanter.com/excel-programming/324488-paste-winword-problems-several-processes.html)

lasse g

Paste in WinWord, problems with several processes
 
When using the following code, winword remain as an process in task-manager.
That become a problem when I run the macro again and again. I had hundereds
of processes running.
_____________________________________
Dim wdbasic As Object
Set wdbasic = CreateObject("word.basic")
With wdbasic
.FileOpen "I:\PROTOKOL\" & yyyy & "\" & inv$ & b$ & "." & yy & iLOOP
& ".doc"
.EditPaste
.FileSave
.fileclose
End With
Set wdbasic = Nothing
______________________________________
any clue ?

Ed

Paste in WinWord, problems with several processes
 
Why are you using
CreateObject("word.basic")
instead of
CreateObject("Word.Application")???

For that matter, if you are going to open and work with a specific Word doc,
then why not something like:

Dim WD As Object
Dim doc As Object
Dim dName As String
Set WD = CreateObject("Word.Application")
dName = "I:\PROTOKOL\" & yyyy & "\" & inv$ & b$ & "." & yy & iLOOP & ".doc"
Set doc = WD.Documents.Add dName
With doc
.EditPaste
.FileSave
.fileclose
End With

WD.Quit
Set doc = Nothing
Set WD = Nothing

(Note: pieced together from previous macros; not tested like this)
Ed

"lasse g" <lasse wrote in message
...
When using the following code, winword remain as an process in

task-manager.
That become a problem when I run the macro again and again. I had

hundereds
of processes running.
_____________________________________
Dim wdbasic As Object
Set wdbasic = CreateObject("word.basic")
With wdbasic
.FileOpen "I:\PROTOKOL\" & yyyy & "\" & inv$ & b$ & "." & yy &

iLOOP
& ".doc"
.EditPaste
.FileSave
.fileclose
End With
Set wdbasic = Nothing
______________________________________
any clue ?




Markus Scheible[_2_]

Paste in WinWord, problems with several processes
 
Hi Lasse,

When using the following code, winword remain as an

process in task-manager.
That become a problem when I run the macro again and

again. I had hundereds
of processes running.
any clue ?
.



Well, I know that the same is happening when opening and
closing Outlook... maybe its a whole Office task that
closed programs are not unloaded from the task manager...

This is no solution for your problem, I know, but I just
want to give "my two cents" ;o)

Best

Markus


All times are GMT +1. The time now is 02:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com