Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Runtime error 429

I have a macro that will not run consistantly, keeps getting runtime errror
429: activex component can't creat object. Are my set and dim codes
wrong:??
Dim myDoc As Word.Document
Set myDoc =
Word.Documents.Open("\\powervault2\home_pl\common\ Referrals\Referal Agency -
Ecology.doc")


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Runtime error 429

It needs an instance of Word in which to open the document... Give this a
try...

dim appWord as object
dim myDoc as object

set appWord = CreateObject("Word.Application")
set myDoc =
appWord.Documents.Open("\\powervault2\home_pl\comm on\Referrals\Referal Agency
-
Ecology.doc")
--
HTH...

Jim Thomlinson


"Michelle Hanan" wrote:

I have a macro that will not run consistantly, keeps getting runtime errror
429: activex component can't creat object. Are my set and dim codes
wrong:??
Dim myDoc As Word.Document
Set myDoc =
Word.Documents.Open("\\powervault2\home_pl\common\ Referrals\Referal Agency -
Ecology.doc")



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Runtime error 429

That seems to work great. I now need to put in a code to close the document
at the end of the macro.I'm just not sure where this needs to be placed.
Here is the ending of the macro. Thanks!
FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
End Sub
"Jim Thomlinson" wrote in message
...
It needs an instance of Word in which to open the document... Give this a
try...

dim appWord as object
dim myDoc as object

set appWord = CreateObject("Word.Application")
set myDoc =
appWord.Documents.Open("\\powervault2\home_pl\comm on\Referrals\Referal
Agency
-
Ecology.doc")
--
HTH...

Jim Thomlinson


"Michelle Hanan" wrote:

I have a macro that will not run consistantly, keeps getting runtime
errror
429: activex component can't creat object. Are my set and dim codes
wrong:??
Dim myDoc As Word.Document
Set myDoc =
Word.Documents.Open("\\powervault2\home_pl\common\ Referrals\Referal
Agency -
Ecology.doc")





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Runtime error 429

Maybe this will clear things up a bit. I am running 17 different macros that
call eachother at the end. I need something also at the end to close the
macro so the next one will run. Right now without that code it opens the
first document which is ecology and prints this one 17 times. And all 17
documents are opening with the macro but not printing or closing. This is
what my macros look like:

Sub Ecology()
Dim appWord As Object
Dim myDoc As Object
Set appWord = CreateObject("Word.Application")
Set myDoc =
appWord.Documents.Open("\\powervault2\home_pl\comm on\Referrals\Referal
Agency - Ecology.doc")
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:= _
"\\powervault2\home_pl\common\Referrals\Referals.x ls", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="",
_
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False,
_
Format:=wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";Us er ID=Admin;Data
Source=\\powervault2\home_pl\common\Referrals\Refe rals.xls;Mode=Read;Extended
Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet
OLEDB:Registry Path="""";Jet OLEDB:Database Pa" _
, SQLStatement:="SELECT * FROM `Sheet1$`", SQLStatement1:="",
SubType:= _
wdMergeSubTypeAccess
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
Call Assessor
End With
End Sub

Sub Assessor()
Dim appWord As Object
Dim myDoc As Object
Set appWord = CreateObject("Word.Application")
Set myDoc =
appWord.Documents.Open("\\powervault2\home_pl\comm on\Referrals\Referal
Agency - Assessor.doc")
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:= _
"\\powervault2\home_pl\common\Referrals\Referals.x ls", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="",
_
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False,
_
Format:=wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";Us er ID=Admin;Data
Source=\\powervault2\home_pl\common\Referrals\Refe rals.xls;Mode=Read;Extended
Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet
OLEDB:Registry Path="""";Jet OLEDB:Database Pa" _
, SQLStatement:="SELECT * FROM `Sheet1$`", SQLStatement1:="",
SubType:= _
wdMergeSubTypeAccess
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
Call BuildingFireSafety
End With
End Sub
"Michelle Hanan" wrote in message
...
That seems to work great. I now need to put in a code to close the
document at the end of the macro.I'm just not sure where this needs to be
placed.
Here is the ending of the macro. Thanks!
FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
End Sub
"Jim Thomlinson" wrote in
message ...
It needs an instance of Word in which to open the document... Give this a
try...

dim appWord as object
dim myDoc as object

set appWord = CreateObject("Word.Application")
set myDoc =
appWord.Documents.Open("\\powervault2\home_pl\comm on\Referrals\Referal
Agency
-
Ecology.doc")
--
HTH...

Jim Thomlinson


"Michelle Hanan" wrote:

I have a macro that will not run consistantly, keeps getting runtime
errror
429: activex component can't creat object. Are my set and dim codes
wrong:??
Dim myDoc As Word.Document
Set myDoc =
Word.Documents.Open("\\powervault2\home_pl\common\ Referrals\Referal
Agency -
Ecology.doc")







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
runtime error: syntax error or access violation oucsester Excel Programming 0 May 3rd 06 02:22 PM
Runtime error '1004' General ODBC error star_lucas New Users to Excel 0 August 29th 05 04:09 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM
Unknown where is the problem on the Runtime error - Automation error wellie Excel Programming 1 July 10th 03 08:12 AM


All times are GMT +1. The time now is 05:03 PM.

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

About Us

"It's about Microsoft Excel"