Anyone any ideas about Word macros?

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi Domski,

Running a macro in Word is just like in Excel. Tools > Macro > Macros.

The macro can also be assigned to a button, in the same way you would do it in Excel.

One thing you need to watch out for when adding the macro to a Word document. It is quite easy to accidentally place the macro in the Normal template rather than in the document. This is fine if you want the macro to be available in every Word document. But if the macro is unique to the document you are editing, in the Visual Basic Editor, be sure that you add the new macro module to the Project (DocumentX) project.

Damon
 
Upvote 0
Hi,

The code you're referring to is apparently meant to be run from a userform named 'QueryForm' - you can see that from the CloseBtn_Click sub. It seems that form has at least 3 buttons: CloseBtn, FindBtn and ReplaceBtn.

Without the form and those buttons, you could get the code to run by deleting the word 'Private' from these two subs:
Code:
Private Sub FindBtn_Click()
' just find, no replace
Call DoReplace(wdReplaceNone)
End Sub

Private Sub ReplaceBtn_Click()
' replace it
Call DoReplace(wdReplaceAll)
End Sub
then selecting either macro in the normal way.

Cheers
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top