Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Error Driving Me Crazy


Hi all,

I am working with an application I am making. It tries to send some
data from excel to word. To do so, I make a template on word and say in
excel to find and replace some values.

The thing is that the code to find and replace works perfectly in my
computer, but when I try to do it in another one crashes and gives the
following error:

THE FOLLOWING ERROR HAS OCURRED -2147023113(8007067F) ON EXECUTION
TIME.

ERROR ON THE METHOD 'EXECUTE' OF THE OBJECT 'FIND'

The code I am using is
- Dim DocWord As Word.Document
Dim VariableWord As Word.Application
Set VariableWord = New Word.Application

Set DocWord = VariableWord.Documents.Add("I:\RIESGOS
OPERACIONALES\Sarbanes-Oxley\Aplicación sox\recomendaciones.dot")
VariableWord.Visible = False

With DocWord.Content.Find
..Execute findtext:="{texto1}", replacewith:=encabezado.Text,
Replace:=wdReplaceAll
..Execute findtext:="{texto2}", replacewith:=cuerpo1.Text,
Replace:=wdReplaceAll
..Execute findtext:="{texto3}", replacewith:=cuerpo2.Text,
Replace:=wdReplaceAll
..Execute findtext:="{texto4}", replacewith:=pie.Text,
Replace:=wdReplaceAll-

I WILL APRECIATE SOME HELP!! THANK YOU VERY MUCH


--
internacio
------------------------------------------------------------------------
internacio's Profile: http://www.excelforum.com/member.php...o&userid=30960
View this thread: http://www.excelforum.com/showthread...hreadid=522742

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Error Driving Me Crazy

Try the simplest first. You last line of code has

Replace:=wdReplaceAll-

is the "-" on the end a stray character or actually in your code. If in
your code, that might be the problem.

Otherwise - some guesses.


Try qualifying your objects. Ex:
replacewith:=encabezado.Text,

should be something like

replacewith:=userform1.encabezado.Text,

perhaps.

also, it looks like you are using earling binding, but if your not, perhaps
replace

wdReplaceAll with the value it represents.

--
Regards,
Tom Ogilvy



"internacio" wrote:


Hi all,

I am working with an application I am making. It tries to send some
data from excel to word. To do so, I make a template on word and say in
excel to find and replace some values.

The thing is that the code to find and replace works perfectly in my
computer, but when I try to do it in another one crashes and gives the
following error:

THE FOLLOWING ERROR HAS OCURRED -2147023113(8007067F) ON EXECUTION
TIME.

ERROR ON THE METHOD 'EXECUTE' OF THE OBJECT 'FIND'

The code I am using is
- Dim DocWord As Word.Document
Dim VariableWord As Word.Application
Set VariableWord = New Word.Application

Set DocWord = VariableWord.Documents.Add("I:\RIESGOS
OPERACIONALES\Sarbanes-Oxley\Aplicación sox\recomendaciones.dot")
VariableWord.Visible = False

With DocWord.Content.Find
.Execute findtext:="{texto1}", replacewith:=encabezado.Text,
Replace:=wdReplaceAll
.Execute findtext:="{texto2}", replacewith:=cuerpo1.Text,
Replace:=wdReplaceAll
.Execute findtext:="{texto3}", replacewith:=cuerpo2.Text,
Replace:=wdReplaceAll
.Execute findtext:="{texto4}", replacewith:=pie.Text,
Replace:=wdReplaceAll-

I WILL APRECIATE SOME HELP!! THANK YOU VERY MUCH


--
internacio
------------------------------------------------------------------------
internacio's Profile: http://www.excelforum.com/member.php...o&userid=30960
View this thread: http://www.excelforum.com/showthread...hreadid=522742


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Error Driving Me Crazy

The problem might be a missing reference on the other PC.
Try with late binding like this:

Dim VariableWord As Object
Set VariableWord = CreateObject("Word.Application")

Good chance that will fix the problem.

RBS

"internacio" wrote
in message ...

Hi all,

I am working with an application I am making. It tries to send some
data from excel to word. To do so, I make a template on word and say in
excel to find and replace some values.

The thing is that the code to find and replace works perfectly in my
computer, but when I try to do it in another one crashes and gives the
following error:

THE FOLLOWING ERROR HAS OCURRED -2147023113(8007067F) ON EXECUTION
TIME.

ERROR ON THE METHOD 'EXECUTE' OF THE OBJECT 'FIND'

The code I am using is
- Dim DocWord As Word.Document
Dim VariableWord As Word.Application
Set VariableWord = New Word.Application

Set DocWord = VariableWord.Documents.Add("I:\RIESGOS
OPERACIONALES\Sarbanes-Oxley\Aplicación sox\recomendaciones.dot")
VariableWord.Visible = False

With DocWord.Content.Find
Execute findtext:="{texto1}", replacewith:=encabezado.Text,
Replace:=wdReplaceAll
Execute findtext:="{texto2}", replacewith:=cuerpo1.Text,
Replace:=wdReplaceAll
Execute findtext:="{texto3}", replacewith:=cuerpo2.Text,
Replace:=wdReplaceAll
Execute findtext:="{texto4}", replacewith:=pie.Text,
Replace:=wdReplaceAll-

I WILL APRECIATE SOME HELP!! THANK YOU VERY MUCH


--
internacio
------------------------------------------------------------------------
internacio's Profile:
http://www.excelforum.com/member.php...o&userid=30960
View this thread: http://www.excelforum.com/showthread...hreadid=522742


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Error Driving Me Crazy

Forgot to say that if you use late binding you will have to replace:
wdReplaceAll with the number 2

RBS

"RB Smissaert" wrote in message
...
The problem might be a missing reference on the other PC.
Try with late binding like this:

Dim VariableWord As Object
Set VariableWord = CreateObject("Word.Application")

Good chance that will fix the problem.

RBS

"internacio"
wrote in message
...

Hi all,

I am working with an application I am making. It tries to send some
data from excel to word. To do so, I make a template on word and say in
excel to find and replace some values.

The thing is that the code to find and replace works perfectly in my
computer, but when I try to do it in another one crashes and gives the
following error:

THE FOLLOWING ERROR HAS OCURRED -2147023113(8007067F) ON EXECUTION
TIME.

ERROR ON THE METHOD 'EXECUTE' OF THE OBJECT 'FIND'

The code I am using is
- Dim DocWord As Word.Document
Dim VariableWord As Word.Application
Set VariableWord = New Word.Application

Set DocWord = VariableWord.Documents.Add("I:\RIESGOS
OPERACIONALES\Sarbanes-Oxley\Aplicación sox\recomendaciones.dot")
VariableWord.Visible = False

With DocWord.Content.Find
Execute findtext:="{texto1}", replacewith:=encabezado.Text,
Replace:=wdReplaceAll
Execute findtext:="{texto2}", replacewith:=cuerpo1.Text,
Replace:=wdReplaceAll
Execute findtext:="{texto3}", replacewith:=cuerpo2.Text,
Replace:=wdReplaceAll
Execute findtext:="{texto4}", replacewith:=pie.Text,
Replace:=wdReplaceAll-

I WILL APRECIATE SOME HELP!! THANK YOU VERY MUCH


--
internacio
------------------------------------------------------------------------
internacio's Profile:
http://www.excelforum.com/member.php...o&userid=30960
View this thread:
http://www.excelforum.com/showthread...hreadid=522742



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
Driving me CRAZY~ please help Tara New Users to Excel 0 July 7th 08 07:29 PM
Driving me crazy! RobEdgeler[_7_] Excel Programming 0 October 3rd 05 10:19 PM
It doesn't add up - It's driving me crazy Francis Hayes (The Excel Addict) Excel Programming 10 February 28th 05 10:40 PM
Error Handling driving me crazy. Please help hyyfte[_17_] Excel Programming 2 September 22nd 04 07:06 PM
Driving me crazy! Dick Kusleika[_3_] Excel Programming 0 October 21st 03 10:18 PM


All times are GMT +1. The time now is 11:57 AM.

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"