Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Word dialog editreplace

The following code opens a word document to be edited. The WordDialog is to
find and replace the text without user interaction. How do I get the Word
Dialog to do this???? WordDialog.execute doesn't work. Any ideas?????


Set WordApp = CreateObject("word.application") 'open Word session
WordApp.Visible = True 'Word visible during operation
WordApp.Activate
Set WordDoc = WordApp.Documents.Open(file_path) 'open Word doc
Set WordDialog = WordApp.Dialogs(wdDialogEditReplace)
With WordDialog
.Find = "<RIA name"
.Replace = "TESTING!!!"
End With
On Error Resume Next
WordDialog.Execute
On Error GoTo Err_WordDocs

Thank You,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Word dialog editreplace

Hi

Dialogs ARE for user interaction. Without user interaction don't use
dialogs.

Record a macro in Word as you do a manual find-replace, and you'll get
pretty good code for automatic find-replace.

HTH. Best wishes Harald

"Shawn G." skrev i melding
...
The following code opens a word document to be edited. The WordDialog is
to
find and replace the text without user interaction. How do I get the Word
Dialog to do this???? WordDialog.execute doesn't work. Any ideas?????


Set WordApp = CreateObject("word.application") 'open Word session
WordApp.Visible = True 'Word visible during operation
WordApp.Activate
Set WordDoc = WordApp.Documents.Open(file_path) 'open Word doc
Set WordDialog = WordApp.Dialogs(wdDialogEditReplace)
With WordDialog
.Find = "<RIA name"
.Replace = "TESTING!!!"
End With
On Error Resume Next
WordDialog.Execute
On Error GoTo Err_WordDocs

Thank You,



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Word dialog editreplace

Any idea how to convert this to a find and replace without interaction?

"Harald Staff" wrote:

Hi

Dialogs ARE for user interaction. Without user interaction don't use
dialogs.

Record a macro in Word as you do a manual find-replace, and you'll get
pretty good code for automatic find-replace.

HTH. Best wishes Harald

"Shawn G." skrev i melding
...
The following code opens a word document to be edited. The WordDialog is
to
find and replace the text without user interaction. How do I get the Word
Dialog to do this???? WordDialog.execute doesn't work. Any ideas?????


Set WordApp = CreateObject("word.application") 'open Word session
WordApp.Visible = True 'Word visible during operation
WordApp.Activate
Set WordDoc = WordApp.Documents.Open(file_path) 'open Word doc
Set WordDialog = WordApp.Dialogs(wdDialogEditReplace)
With WordDialog
.Find = "<RIA name"
.Replace = "TESTING!!!"
End With
On Error Resume Next
WordDialog.Execute
On Error GoTo Err_WordDocs

Thank You,




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Word dialog editreplace

Figured it out, Thanks for the Help!

Set WordApp = CreateObject("word.application") 'open Word session
WordApp.Visible = True 'Word visible during operation
WordApp.Activate
Set WordDoc = WordApp.Documents.Open(file_path) 'open Word doc

With WordDoc.Content.Find
.text = "<RIA name"
With .Replacement
.text = "testing!!!"
End With
.Execute Replace:=wdReplaceAll
End With

On Error Resume Next

On Error GoTo Err_WordDocs


"Shawn G." wrote:

Any idea how to convert this to a find and replace without interaction?

"Harald Staff" wrote:

Hi

Dialogs ARE for user interaction. Without user interaction don't use
dialogs.

Record a macro in Word as you do a manual find-replace, and you'll get
pretty good code for automatic find-replace.

HTH. Best wishes Harald

"Shawn G." skrev i melding
...
The following code opens a word document to be edited. The WordDialog is
to
find and replace the text without user interaction. How do I get the Word
Dialog to do this???? WordDialog.execute doesn't work. Any ideas?????


Set WordApp = CreateObject("word.application") 'open Word session
WordApp.Visible = True 'Word visible during operation
WordApp.Activate
Set WordDoc = WordApp.Documents.Open(file_path) 'open Word doc
Set WordDialog = WordApp.Dialogs(wdDialogEditReplace)
With WordDialog
.Find = "<RIA name"
.Replace = "TESTING!!!"
End With
On Error Resume Next
WordDialog.Execute
On Error GoTo Err_WordDocs

Thank You,




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Word dialog editreplace

That was fast. Good job, thanks for the feedback.

Best wishes Harald

"Shawn G." skrev i melding
...
Figured it out, Thanks for the Help!





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
How to delete the "Insert Function Dialog Box" (dialog box only)? TBI''d biker Excel Worksheet Functions 2 April 7th 07 09:18 PM
Print labels by using Excel data in a Word mail into word Zoey Excel Discussion (Misc queries) 1 November 1st 05 09:08 PM
Embedded word doc changed to image-need to change back to word. cflores Excel Discussion (Misc queries) 0 January 23rd 05 06:45 AM
control of dialog macro dialog box. on open Gerry Abbott Excel Programming 0 July 22nd 04 05:41 PM


All times are GMT +1. The time now is 01:06 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"