Getting Started Problems

D

Dan

Hello,

I'm very new to VBA and coding. I've been installed large software projects, but I'd like to create a few productivitity tools. Here's a few things I need help with.

I can't get the toolbox to display in any office product. The Icon is there but it's greyed out.

Second I have created a macro that I corrects certain spelling errors and changes formats of the words it corrects. However, it's not very efficient. I have to copy the "Replacement" command for every word. I'd like to create a loop of some kind that check for a word, finds it's match and executes the replacement for as long as there are words to be checked. Arrays look interesting, but I can't figure them out and I think I need to build a table somewhere of matching words. I'm not sure how to do that or if my approach is sound.

I think if I can do that, I'll be able to add or subtract words I as I like without adding many lines of code to the macro.

I'm not looking for someone to code it just point out how to approach this and what VBA commands come into play.

Thanks.
 
W

Word Heretic

G'day Dan,

1: Create a userform and select it, is the toobox still greyed out?

2:

Dim MyWords(2,100) as string
MyWords(1,1)="Find this"
MyWords(2,1)="Replace with this"
....

with selection.find
'setup everything for your searches
end with

for k=1 to 100
selection.find.text=mywords(1,k)
selection.find.replacement.text=mywords(2,k)
selection.find.execute replace:=wdreplaceall
next

However, I would stuff the words into a text file and read them from
there using file Open statements and the like, reading until EOF.

Steve Hudson
Word Heretic Sydney Australia
Tricky stuff with Word or words

Email: WordHeretic at tpg.com.au


Dan was spinning this yarn:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top