Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Callling Word fronm Excel


I am stumped. I am running the below code to print a mail merge. Excel stars
word , the mail merge macro in word runs and prints but Excel opens

debugger
and halts at .Documents.Open ("D:\Duane
Docs\Inspection_Report_browser_Merge2008_Fields.do c")
witrh the comment "Word can not open this file"
What am I missing here.
Thanks in advance
Duane

Sub ControlWordFromXL()


Dim objWord As Word.Application
'Set objWord = New Word.Application

With objWord
.Visible = True
.Activate
.WindowState = wdWindowStateMaximize
.Documents.Open ("D:\Duane
Docs\Inspection_Report_browser_Merge2008_Fields.do c")
End With
End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Callling Word fronm Excel


It worked for me after removing the comment ( ' ) in front of Set.
(I used a correct file path/file for my system)
Also, it is a good idea to set object variables to nothing when using automation...
Add this line just before End Sub...
Set objWord = Nothing
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Duane Reynolds 322310"
wrote in message
I am stumped. I am running the below code to print a mail merge.
Excel stars word , the mail merge macro in word runs and prints
but Excel opens debugger and halts at .Documents.Open ("D:\Duane
Docs\Inspection_Report_browser_Merge2008_Fields.do c")

witrh the comment "Word can not open this file"
What am I missing here.
Thanks in advance
Duane

Sub ControlWordFromXL()


Dim objWord As Word.Application
'Set objWord = New Word.Application

With objWord
.Visible = True
.Activate
.WindowState = wdWindowStateMaximize
.Documents.Open ("D:\Duane
Docs\Inspection_Report_browser_Merge2008_Fields.do c")
End With
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Callling Word fronm Excel

It runs and executes just fine on my system but opens debug and highlights
that one line leaves excel open
Duane
"Jim Cone" wrote in message
...

It worked for me after removing the comment ( ' ) in front of Set.
(I used a correct file path/file for my system)
Also, it is a good idea to set object variables to nothing when using
automation...
Add this line just before End Sub...
Set objWord = Nothing
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Duane Reynolds 322310"
wrote in message
I am stumped. I am running the below code to print a mail merge.
Excel stars word , the mail merge macro in word runs and prints
but Excel opens debugger and halts at .Documents.Open ("D:\Duane
Docs\Inspection_Report_browser_Merge2008_Fields.do c")

witrh the comment "Word can not open this file"
What am I missing here.
Thanks in advance
Duane

Sub ControlWordFromXL()


Dim objWord As Word.Application
'Set objWord = New Word.Application

With objWord
.Visible = True
.Activate
.WindowState = wdWindowStateMaximize
.Documents.Open ("D:\Duane
Docs\Inspection_Report_browser_Merge2008_Fields.do c")
End With
End Sub





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Callling Word fronm Excel


"but opens debug and highlights that one line leaves excel open"

Huh...
What line?
There is nothing in your posted code that closes Excel, why wouldn't it still be open?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"Duane Reynolds 322310"
wrote in message
It runs and executes just fine on my system but opens debug and highlights
that one line leaves excel open
Duane

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Callling Word fronm Excel

Sorry next line after that sub is Application.quit but it stalls at
.Documents.Open ("D:\Duane
Docs\Inspection_Report_browser_Merge2008_Fields.do c") with this line
highlighted in yellow in debug.

"Jim Cone" wrote in message
...

"but opens debug and highlights that one line leaves excel open"

Huh...
What line?
There is nothing in your posted code that closes Excel, why wouldn't it
still be open?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"Duane Reynolds 322310"
wrote in message
It runs and executes just fine on my system but opens debug and highlights
that one line leaves excel open
Duane





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Callling Word fronm Excel


Your posted code should be all on one line (not two lines).
If that is not the problem then the file path and/or file name is probably incorrect.
'--
..Documents.Open ("D:\Duane Docs\Inspection_Report_browser_Merge2008_Fields.do c")
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Duane Reynolds 322310"

wrote in message
Sorry next line after that sub is Application.quit but it stalls at
.Documents.Open ("D:\Duane
Docs\Inspection_Report_browser_Merge2008_Fields.do c") with this line
highlighted in yellow in debug.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Excel count of 1 word if found in multi-word cells of column Function_Challenged Excel Worksheet Functions 1 August 27th 09 12:08 AM
Copy from Word to Excel, and retain indent, plus word wrap Eric Excel Discussion (Misc queries) 1 March 9th 07 03:15 AM
Import cells from excel into word and create multiple word docs scdaddy7269 Excel Programming 2 March 20th 06 07:03 PM
Printing Word Document using Excel Programming hangs Word Alan Excel Programming 0 September 30th 04 08:41 PM
How do I determine a Function's callling Row Number. Mac Lingo[_2_] Excel Programming 2 August 26th 04 02:00 PM


All times are GMT +1. The time now is 01:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"