Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word 2003 Find/Change Automation from Excel 2003 crashes Excel 200
I just upgraded to Office Professional 2003 from Office Professional XP.
The following code, when executed, completely and irrevocably crashes Microsoft Excel 2003 at the line <.Text = "^pDescription". It worked just find in Microsoft Excel XP. It even asks to send a report to Microsoft. Every time. Easily reproducible. I have updated to all service packs/patches, etc., too. Also, the line <Selection.Find.Replacement.ClearFormatting gives a "Automation error: the procedure number is out of range" error, which it didn't do before in Excel 2003. What the heck happened between the two versions? Now my code has completely blown up!!! Any ideas????? Any help would be greatly appreciated, as we have to get this program up and running for production! Thanks!!! Public Sub Test() Dim appWord As Word.Application Set appWord = New Word.Application appWord.Documents.Add appWord.Selection.Find.ClearFormatting appWord.Selection.Find.Replacement.ClearFormatting With appWord.Selection.Find .Text = "^pBREAK" .Replacement.Text = "-----" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With appwordSelection.Find.Execute Replace:=wdReplaceAll appWord.ActiveDocument.SaveAs "C:\TEST.DOC" appWord.ActiveDocument.Close appWord.Quit Set appWord = Nothing End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word 2003 Find/Change Automation from Excel 2003 crashes Excel 200
There is no line
<.Text = "^pDescription" regardless, since all of this is performing actions in word, why not ask in a word group where you may have a higher probability of reaching someone who knows about the word object model. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... I just upgraded to Office Professional 2003 from Office Professional XP. The following code, when executed, completely and irrevocably crashes Microsoft Excel 2003 at the line <.Text = "^pDescription". It worked just find in Microsoft Excel XP. It even asks to send a report to Microsoft. Every time. Easily reproducible. I have updated to all service packs/patches, etc., too. Also, the line <Selection.Find.Replacement.ClearFormatting gives a "Automation error: the procedure number is out of range" error, which it didn't do before in Excel 2003. What the heck happened between the two versions? Now my code has completely blown up!!! Any ideas????? Any help would be greatly appreciated, as we have to get this program up and running for production! Thanks!!! Public Sub Test() Dim appWord As Word.Application Set appWord = New Word.Application appWord.Documents.Add appWord.Selection.Find.ClearFormatting appWord.Selection.Find.Replacement.ClearFormatting With appWord.Selection.Find .Text = "^pBREAK" .Replacement.Text = "-----" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With appwordSelection.Find.Execute Replace:=wdReplaceAll appWord.ActiveDocument.SaveAs "C:\TEST.DOC" appWord.ActiveDocument.Close appWord.Quit Set appWord = Nothing End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word 2003 Find/Change Automation from Excel 2003 crashes Excel
Thanks, Tom.
You're right. The line is the "^pBREAK" line. I was testing it again with a different text to find. So, the line that is causing the crash is the ".Text = ^pBREAK" line. The reason I posted it here is because it works flawlessly in Word 2003. It's when you call it from a Word.Application object from within Excel that it crashes. So, it's not necessarily a Word problem. Make sense? "Tom Ogilvy" wrote: There is no line <.Text = "^pDescription" regardless, since all of this is performing actions in word, why not ask in a word group where you may have a higher probability of reaching someone who knows about the word object model. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... I just upgraded to Office Professional 2003 from Office Professional XP. The following code, when executed, completely and irrevocably crashes Microsoft Excel 2003 at the line <.Text = "^pDescription". It worked just find in Microsoft Excel XP. It even asks to send a report to Microsoft. Every time. Easily reproducible. I have updated to all service packs/patches, etc., too. Also, the line <Selection.Find.Replacement.ClearFormatting gives a "Automation error: the procedure number is out of range" error, which it didn't do before in Excel 2003. What the heck happened between the two versions? Now my code has completely blown up!!! Any ideas????? Any help would be greatly appreciated, as we have to get this program up and running for production! Thanks!!! Public Sub Test() Dim appWord As Word.Application Set appWord = New Word.Application appWord.Documents.Add appWord.Selection.Find.ClearFormatting appWord.Selection.Find.Replacement.ClearFormatting With appWord.Selection.Find .Text = "^pBREAK" .Replacement.Text = "-----" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With appwordSelection.Find.Execute Replace:=wdReplaceAll appWord.ActiveDocument.SaveAs "C:\TEST.DOC" appWord.ActiveDocument.Close appWord.Quit Set appWord = Nothing End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word 2003 Find/Change Automation from Excel 2003 crashes Excel
Did it work the first time you ran it? Then develop problems.
Look in the task manager and see if you have multiple versions of word running xl2000 purportedly had some problems using the with construct in an automation environment. Perhaps the error has reappeared in xl2003. Looks like you have created a reference to the Word Object model (make sure it is the correct version), so constant definitions shouldn't be a problem. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... Thanks, Tom. You're right. The line is the "^pBREAK" line. I was testing it again with a different text to find. So, the line that is causing the crash is the ".Text = ^pBREAK" line. The reason I posted it here is because it works flawlessly in Word 2003. It's when you call it from a Word.Application object from within Excel that it crashes. So, it's not necessarily a Word problem. Make sense? "Tom Ogilvy" wrote: There is no line <.Text = "^pDescription" regardless, since all of this is performing actions in word, why not ask in a word group where you may have a higher probability of reaching someone who knows about the word object model. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... I just upgraded to Office Professional 2003 from Office Professional XP. The following code, when executed, completely and irrevocably crashes Microsoft Excel 2003 at the line <.Text = "^pDescription". It worked just find in Microsoft Excel XP. It even asks to send a report to Microsoft. Every time. Easily reproducible. I have updated to all service packs/patches, etc., too. Also, the line <Selection.Find.Replacement.ClearFormatting gives a "Automation error: the procedure number is out of range" error, which it didn't do before in Excel 2003. What the heck happened between the two versions? Now my code has completely blown up!!! Any ideas????? Any help would be greatly appreciated, as we have to get this program up and running for production! Thanks!!! Public Sub Test() Dim appWord As Word.Application Set appWord = New Word.Application appWord.Documents.Add appWord.Selection.Find.ClearFormatting appWord.Selection.Find.Replacement.ClearFormatting With appWord.Selection.Find .Text = "^pBREAK" .Replacement.Text = "-----" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With appwordSelection.Find.Execute Replace:=wdReplaceAll appWord.ActiveDocument.SaveAs "C:\TEST.DOC" appWord.ActiveDocument.Close appWord.Quit Set appWord = Nothing End Sub |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word 2003 Find/Change Automation from Excel 2003 crashes Excel
It worked perfectly under Excel XP (2002), but it hasn't worked yet under
Excel 2003. Yes, there are all kinds of WINWORD.EXEs running in the task manager -- one for every time I have run this and it fails (which is every time). It runs the code perfectly until it gets to the <.Text=... line, and then it crashes Excel! "Tom Ogilvy" wrote: Did it work the first time you ran it? Then develop problems. Look in the task manager and see if you have multiple versions of word running xl2000 purportedly had some problems using the with construct in an automation environment. Perhaps the error has reappeared in xl2003. Looks like you have created a reference to the Word Object model (make sure it is the correct version), so constant definitions shouldn't be a problem. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... Thanks, Tom. You're right. The line is the "^pBREAK" line. I was testing it again with a different text to find. So, the line that is causing the crash is the ".Text = ^pBREAK" line. The reason I posted it here is because it works flawlessly in Word 2003. It's when you call it from a Word.Application object from within Excel that it crashes. So, it's not necessarily a Word problem. Make sense? "Tom Ogilvy" wrote: There is no line <.Text = "^pDescription" regardless, since all of this is performing actions in word, why not ask in a word group where you may have a higher probability of reaching someone who knows about the word object model. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... I just upgraded to Office Professional 2003 from Office Professional XP. The following code, when executed, completely and irrevocably crashes Microsoft Excel 2003 at the line <.Text = "^pDescription". It worked just find in Microsoft Excel XP. It even asks to send a report to Microsoft. Every time. Easily reproducible. I have updated to all service packs/patches, etc., too. Also, the line <Selection.Find.Replacement.ClearFormatting gives a "Automation error: the procedure number is out of range" error, which it didn't do before in Excel 2003. What the heck happened between the two versions? Now my code has completely blown up!!! Any ideas????? Any help would be greatly appreciated, as we have to get this program up and running for production! Thanks!!! Public Sub Test() Dim appWord As Word.Application Set appWord = New Word.Application appWord.Documents.Add appWord.Selection.Find.ClearFormatting appWord.Selection.Find.Replacement.ClearFormatting With appWord.Selection.Find .Text = "^pBREAK" .Replacement.Text = "-----" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With appwordSelection.Find.Execute Replace:=wdReplaceAll appWord.ActiveDocument.SaveAs "C:\TEST.DOC" appWord.ActiveDocument.Close appWord.Quit Set appWord = Nothing End Sub |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word 2003 Find/Change Automation from Excel 2003 crashes Excel
I don't have xl2003 installed here, but running in xl2002 I got an error in
appWordSelection.Find.Execute Replace:=wdReplaceAll for the obvious reason. It did put an instance or word running in the task manager. It ran fine after that, but perhaps that might not be the case in xl2003. I would fix the code, then close excel. Make sure the task manager has no instances of word running, then try again. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... It worked perfectly under Excel XP (2002), but it hasn't worked yet under Excel 2003. Yes, there are all kinds of WINWORD.EXEs running in the task manager -- one for every time I have run this and it fails (which is every time). It runs the code perfectly until it gets to the <.Text=... line, and then it crashes Excel! "Tom Ogilvy" wrote: Did it work the first time you ran it? Then develop problems. Look in the task manager and see if you have multiple versions of word running xl2000 purportedly had some problems using the with construct in an automation environment. Perhaps the error has reappeared in xl2003. Looks like you have created a reference to the Word Object model (make sure it is the correct version), so constant definitions shouldn't be a problem. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... Thanks, Tom. You're right. The line is the "^pBREAK" line. I was testing it again with a different text to find. So, the line that is causing the crash is the ".Text = ^pBREAK" line. The reason I posted it here is because it works flawlessly in Word 2003. It's when you call it from a Word.Application object from within Excel that it crashes. So, it's not necessarily a Word problem. Make sense? "Tom Ogilvy" wrote: There is no line <.Text = "^pDescription" regardless, since all of this is performing actions in word, why not ask in a word group where you may have a higher probability of reaching someone who knows about the word object model. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... I just upgraded to Office Professional 2003 from Office Professional XP. The following code, when executed, completely and irrevocably crashes Microsoft Excel 2003 at the line <.Text = "^pDescription". It worked just find in Microsoft Excel XP. It even asks to send a report to Microsoft. Every time. Easily reproducible. I have updated to all service packs/patches, etc., too. Also, the line <Selection.Find.Replacement.ClearFormatting gives a "Automation error: the procedure number is out of range" error, which it didn't do before in Excel 2003. What the heck happened between the two versions? Now my code has completely blown up!!! Any ideas????? Any help would be greatly appreciated, as we have to get this program up and running for production! Thanks!!! Public Sub Test() Dim appWord As Word.Application Set appWord = New Word.Application appWord.Documents.Add appWord.Selection.Find.ClearFormatting appWord.Selection.Find.Replacement.ClearFormatting With appWord.Selection.Find .Text = "^pBREAK" .Replacement.Text = "-----" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With appwordSelection.Find.Execute Replace:=wdReplaceAll appWord.ActiveDocument.SaveAs "C:\TEST.DOC" appWord.ActiveDocument.Close appWord.Quit Set appWord = Nothing End Sub |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word 2003 Find/Change Automation from Excel 2003 crashes Excel
Thanks, Tom -- the error you got comes from my mistake: there should be a
period after "appWord" in that line of code -- I went through and added an appWord object to specifiy the Selection object, since I was calling it from outside of Word. I just missed the period. That's probably why you got the error... "Tom Ogilvy" wrote: I don't have xl2003 installed here, but running in xl2002 I got an error in appWordSelection.Find.Execute Replace:=wdReplaceAll for the obvious reason. It did put an instance or word running in the task manager. It ran fine after that, but perhaps that might not be the case in xl2003. I would fix the code, then close excel. Make sure the task manager has no instances of word running, then try again. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... It worked perfectly under Excel XP (2002), but it hasn't worked yet under Excel 2003. Yes, there are all kinds of WINWORD.EXEs running in the task manager -- one for every time I have run this and it fails (which is every time). It runs the code perfectly until it gets to the <.Text=... line, and then it crashes Excel! "Tom Ogilvy" wrote: Did it work the first time you ran it? Then develop problems. Look in the task manager and see if you have multiple versions of word running xl2000 purportedly had some problems using the with construct in an automation environment. Perhaps the error has reappeared in xl2003. Looks like you have created a reference to the Word Object model (make sure it is the correct version), so constant definitions shouldn't be a problem. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... Thanks, Tom. You're right. The line is the "^pBREAK" line. I was testing it again with a different text to find. So, the line that is causing the crash is the ".Text = ^pBREAK" line. The reason I posted it here is because it works flawlessly in Word 2003. It's when you call it from a Word.Application object from within Excel that it crashes. So, it's not necessarily a Word problem. Make sense? "Tom Ogilvy" wrote: There is no line <.Text = "^pDescription" regardless, since all of this is performing actions in word, why not ask in a word group where you may have a higher probability of reaching someone who knows about the word object model. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... I just upgraded to Office Professional 2003 from Office Professional XP. The following code, when executed, completely and irrevocably crashes Microsoft Excel 2003 at the line <.Text = "^pDescription". It worked just find in Microsoft Excel XP. It even asks to send a report to Microsoft. Every time. Easily reproducible. I have updated to all service packs/patches, etc., too. Also, the line <Selection.Find.Replacement.ClearFormatting gives a "Automation error: the procedure number is out of range" error, which it didn't do before in Excel 2003. What the heck happened between the two versions? Now my code has completely blown up!!! Any ideas????? Any help would be greatly appreciated, as we have to get this program up and running for production! Thanks!!! Public Sub Test() Dim appWord As Word.Application Set appWord = New Word.Application appWord.Documents.Add appWord.Selection.Find.ClearFormatting appWord.Selection.Find.Replacement.ClearFormatting With appWord.Selection.Find .Text = "^pBREAK" .Replacement.Text = "-----" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With appwordSelection.Find.Execute Replace:=wdReplaceAll appWord.ActiveDocument.SaveAs "C:\TEST.DOC" appWord.ActiveDocument.Close appWord.Quit Set appWord = Nothing End Sub |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word 2003 Find/Change Automation from Excel 2003 crashes Excel
for the obvious reason.
-- Regards, Tom Ogilvy "Joel Berry" wrote in message ... Thanks, Tom -- the error you got comes from my mistake: there should be a period after "appWord" in that line of code -- I went through and added an appWord object to specifiy the Selection object, since I was calling it from outside of Word. I just missed the period. That's probably why you got the error... "Tom Ogilvy" wrote: I don't have xl2003 installed here, but running in xl2002 I got an error in appWordSelection.Find.Execute Replace:=wdReplaceAll for the obvious reason. It did put an instance or word running in the task manager. It ran fine after that, but perhaps that might not be the case in xl2003. I would fix the code, then close excel. Make sure the task manager has no instances of word running, then try again. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... It worked perfectly under Excel XP (2002), but it hasn't worked yet under Excel 2003. Yes, there are all kinds of WINWORD.EXEs running in the task manager -- one for every time I have run this and it fails (which is every time). It runs the code perfectly until it gets to the <.Text=... line, and then it crashes Excel! "Tom Ogilvy" wrote: Did it work the first time you ran it? Then develop problems. Look in the task manager and see if you have multiple versions of word running xl2000 purportedly had some problems using the with construct in an automation environment. Perhaps the error has reappeared in xl2003. Looks like you have created a reference to the Word Object model (make sure it is the correct version), so constant definitions shouldn't be a problem. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... Thanks, Tom. You're right. The line is the "^pBREAK" line. I was testing it again with a different text to find. So, the line that is causing the crash is the ".Text = ^pBREAK" line. The reason I posted it here is because it works flawlessly in Word 2003. It's when you call it from a Word.Application object from within Excel that it crashes. So, it's not necessarily a Word problem. Make sense? "Tom Ogilvy" wrote: There is no line <.Text = "^pDescription" regardless, since all of this is performing actions in word, why not ask in a word group where you may have a higher probability of reaching someone who knows about the word object model. -- Regards, Tom Ogilvy "Joel Berry" wrote in message ... I just upgraded to Office Professional 2003 from Office Professional XP. The following code, when executed, completely and irrevocably crashes Microsoft Excel 2003 at the line <.Text = "^pDescription". It worked just find in Microsoft Excel XP. It even asks to send a report to Microsoft. Every time. Easily reproducible. I have updated to all service packs/patches, etc., too. Also, the line <Selection.Find.Replacement.ClearFormatting gives a "Automation error: the procedure number is out of range" error, which it didn't do before in Excel 2003. What the heck happened between the two versions? Now my code has completely blown up!!! Any ideas????? Any help would be greatly appreciated, as we have to get this program up and running for production! Thanks!!! Public Sub Test() Dim appWord As Word.Application Set appWord = New Word.Application appWord.Documents.Add appWord.Selection.Find.ClearFormatting appWord.Selection.Find.Replacement.ClearFormatting With appWord.Selection.Find .Text = "^pBREAK" .Replacement.Text = "-----" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With appwordSelection.Find.Execute Replace:=wdReplaceAll appWord.ActiveDocument.SaveAs "C:\TEST.DOC" appWord.ActiveDocument.Close appWord.Quit Set appWord = Nothing End Sub |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word 2003 Find/Change Automation from Excel 2003 crashes Excel
Hello
I think I have the same problem but I didnt really understand the solution :-((. Can you please give me a hint what to change in the code to prevent Excel from crashing? Thank you very much! Hein Sub test() Dim wrdApp As Word.Application Dim PfadMod2 As String Set wrdApp = New Word.Application PfadMod2 = "H:\temp9\GesprächAnfang März\PSS-Burghaun-Auestr-22-EifertLo" wrdApp.ChangeFileOpenDirectory _ PfadMod2 ' wrdApp.Documents.Open Filename:="LV.dot", ConfirmConversions:=False, _ ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _ PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _ WritePasswordTemplate:="", Format:=wdOpenFormatAuto wrdApp.Visible = True wrdApp.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader wrdApp.ActiveWindow.ActivePane.View.NextHeaderFoot er wrdApp.ActiveWindow.ActivePane.View.NextHeaderFoot er wrdApp.Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1" wrdApp.Selection.Find.ClearFormatting With wrdApp.Selection.Find .Text = "#R#" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With wrdApp.Selection.Find.Execute End Sub |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word 2003 Find/Change Automation from Excel 2003 crashes Excel
I got it:
http://support.microsoft.com/kb/292744/EN-US/ Hein Heinrichsen wrote: Hello I think I have the same problem but I didnt really understand the solution :-((. Can you please give me a hint what to change in the code to prevent Excel from crashing? Thank you very much! Hein Sub test() Dim wrdApp As Word.Application Dim PfadMod2 As String Set wrdApp = New Word.Application PfadMod2 = "H:\temp9\GesprächAnfang März\PSS-Burghaun-Auestr-22-EifertLo" wrdApp.ChangeFileOpenDirectory _ PfadMod2 ' wrdApp.Documents.Open Filename:="LV.dot", ConfirmConversions:=False, _ ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _ PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _ WritePasswordTemplate:="", Format:=wdOpenFormatAuto wrdApp.Visible = True wrdApp.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader wrdApp.ActiveWindow.ActivePane.View.NextHeaderFoot er wrdApp.ActiveWindow.ActivePane.View.NextHeaderFoot er wrdApp.Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1" wrdApp.Selection.Find.ClearFormatting With wrdApp.Selection.Find .Text = "#R#" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With wrdApp.Selection.Find.Execute End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy in Excel 2003 Paste in Word 2003 | Excel Discussion (Misc queries) | |||
Excel 2003 Crashes | Excel Discussion (Misc queries) | |||
Copy and paste problem Excel 2003 to Word 2003 | Excel Discussion (Misc queries) | |||
Need help with mail merge - excel 2003 to word 2003 please.. | Excel Discussion (Misc queries) | |||
Excel Automation Find/Replace Excel 2000 and 2003 | Excel Programming |