How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask ragankel0323 Your Own Question

ragankel0323
ragankel0323, Sr. Systems Analyst
Category: Computer
Satisfied Customers: 81
Experience:  If it boots up, logs on, or has a touch screen, chances are I have the experience you are looking for :-).
75502995
Type Your Computer Question Here...
ragankel0323 is online now
A new question is answered every 9 seconds

I want to build a macro that will find something, i.e., #,

Resolved Question:

I want to build a macro that will find something, i.e., #, stop, let me replace it with text, go to the next #, stop and let me replace it with different text.
Submitted: 1 year ago.
Category: Computer
Expert:  ragankel0323 replied 1 year ago.

ragankel0323 :

Hello and welcome to Just Answer. I can help you with this. Do you have a spreadsheet that this Macro will be used on. I need to see the layout so I can write the code to work with your structure.

Customer:

No it isn't in a spreadsheet - it would be run in a Word document.

ragankel0323 :

Do you have the Word doc that you will be using the Macro with? I can try to write the Macro in the blind, but it would be easier if I had something to reference

Customer:

Yes I have a sample of something.

Customer:

It will not be the same document every time; I work in a hospital pathology department where standard text when describing a specimen but the measurements change with each specimen.

ragankel0323 :

OK, go to www.wikisend.com upload the file, then post the file ID or download link here so I can work on it this evening.

Customer:

I built a macro for this in Word 2003 a long time ago but can't remember how I did it - of course Word 2007 is different and moving to Word 2010 at our facility soon.

ragankel0323 :

I can write the macro in 2010 and it will be usable in 2007 and 2010

Customer:

That would be terrific!! Thank you

ragankel0323 :

Just upload the file so that I have something to reference then send me the link to download it.

ragankel0323 :

Also, this might take me a day or so, so please be patient and I will get back to you as soon as I have a question or something for you to test.

Customer:

Just sent the file - Example for Macro

Customer:

Link - http://wikisend.com/download/484880/Example for Macro.docx

ragankel0323 :

OK, I will get to work on this tonight and will have something for you soon

Customer:

Thanks - look forward to it

ragankel0323 :

Hello. I have written your macro. I wrote it to look specifically for the "#" character. Do you want to be able to change what you are looking for, or will you always look for that character?

Customer:

The # XXXXX is the one we use.

ragankel0323 :

OK. In order to launch the macro you need to use the "Ctrl-?" key combination (i.e. Ctrl+Shift+/).

Customer:

Got it

ragankel0323 :

I have done two things for you. I have zipped the Word doc that you sent me with the macro already attached so you can just use that doc, and I also zipped up the macro so yo ucan import it into other Word doc's

Customer:

Can I send it to someone else to import?

Customer:

We have multiple users who may want this macro

ragankel0323 :

You can download the zip file here.

You can send it to someone else to import, but you'll need to zip it up as most emails servers will strip the attachment because macros are often used to spread viruses.

ragankel0323 :

Try it out and let me know if you have any questions

ragankel0323 :

Or you could simply send them the entire Word document

Customer:

Can't get the macro to invoke

Customer:

I accessed the Example document and tried Ctrl+Shift+/ - didn't move to the # XXXXX

ragankel0323 :

I wonder if the key combination didn't stay when you opened it...

ragankel0323 :

open the view macros window by looking at (I think) the View tab, them click the down arrow under macros

ragankel0323 :

Could be under the developer tab

Customer:

Did that - drop down is empty

Customer:

Developer is empty also

ragankel0323 :

OK, that's strange? When you launched the Word Doc, did it ask you to enable Macros?

Customer:

No

ragankel0323 :

Try to import the Macro that I included in the Zip file...Open Visual Basic under the developer tab...Click File Import File, then select the macro that is in the Zip file

Customer:

It just asks if I want to open the file

ragankel0323 :

Is it still asking if you would like to open the file?

Customer:

Yes

ragankel0323 :

OK. I just tested this on my co-workers Office 2007 Suite

ragankel0323 :

With the Word Doc open, select the Developer tab

ragankel0323 :

Open Visual Basic

ragankel0323 :

In Visual Basic, click File Import File

ragankel0323 :

Import the FindReplaceNext.bas file that I included in the ZIP fie

ragankel0323 :

This will import the macro into the Word Doc

ragankel0323 :

Once it is imported, you can close Visual Basic, then click on the Macros ribbon under the developer tab

ragankel0323 :

You should now see the FindReplaceNext Macro in the list. You can test it by double clicking it in the list

Customer:

Ok I see it

ragankel0323 :

You will have to assign a shortcut to the macro manually, because aparently the key combination doesn't transfer when you import i

ragankel0323 :

Follow this procedure to assign the shortcut to a key combination:



  1. Click Office buttonWord Options > Customize and then click the Keyboard Shrotcuts Customize button in the bottom left corner of the dialog.


In the next dialog, scroll down through the Categories list and click on Macros. Now click on the name of a macro in the right-hand list, click in the "Press new shortcut key" box, and press the
shortcut you want. Click the Assign button (Important! the shortcut isn't assigned if you just click the Close button without clicking Assign first).

ragankel0323 :

  1. Click Office button
    Word Options
    Customize and then click the Keyboard Shrotcuts Customize button in the bottom left corner of the dialog.
    In the next dialog, scroll down through the Categories list and click on Macros.
    Now click on the name of a macro in the right-hand list, click in the "Press new shortcut key" box
    Press the shortcut you want (Ctrl+?).
    Click the Assign button (Important! the shortcut isn't assigned if you just click the Close button without clicking Assign first).

Customer:

Sorry - had to answer a question. Give me a minute to try this.

Customer:

When I click on Macros in the Customize>Keyboard Shortcuts - the right hand box is blank

Customer:

Shouldn't the Find Replace macro be in that box?

ragankel0323 :

It should be

Customer:

The Save changes in box = Normal.dotm. If I change it to Example for Macro.docx the FindReplaceNext name appears in the box.

ragankel0323 :

Gotcha...So you ar able to assign key combination now...right?

Customer:

Yes

ragankel0323 :

Excellent...How'd the macro work for you?

Customer:

I entered Ctrl+Shift+/

Customer:

and Assign

ragankel0323 :

It should have shown up as Ctrl-? in the assign box

Customer:

Yes

ragankel0323 :

Excellent

Customer:

Ok - I closed the document and reopened. Macro is no longer available.

ragankel0323 :

That's strange.

Customer:

I started from the beginning. Imported the macro, assigned shortcut key.

Customer:

I did this with the document open.

Customer:

Cursor is at the beginning of the paragraph. When I invoke the macro it wants a replacement at the beginning of the paragraph. There is nothing to replace.

ragankel0323 :

Type the replacement text and it will replace the # XXXXX whatever you type

ragankel0323 :

once you click OK

ragankel0323 :

The marco will then move to the next #

Customer:

If I click ok - just closes the replace box. When I try the macro again, still wants a replace value at the beginning of the paragraph. If I move to the first #, replace, hit ok it will move to the next #.

ragankel0323 :

You are using Office 2007, right

Customer:

Yes

ragankel0323 :

I just tested the Macro on both 2010 and 2007 and the Macro works as it should

Customer:

It isn't asking for a Replace value at the beginning of the paragraph?

Customer:

I just invoked the macro again - still asking for Replacement Text at the beginning of the paragraph. I hit the space bar and it moved to the # XXXXX

Customer:

and didn't add the space at the beginning of the paragraph.

Customer:

Tried to close my document - got the message that I had to save it in a Word macro enabled document, which I did.

Customer:

Then when I tried to reopen and invoke the macro got an error message that the macro in this project has been disabled.

Customer:

I went back to my original example - and now no macro!!

ragankel0323 :

Here's what happens when I run the Macro: http://www.mediafire.com/?kprnabasp0s7cbe

Customer:

I don't know what that means

Customer:

I see - you are sending me a video

ragankel0323 :

Here's what happens...I place my cursor at the beginning of the document. I press Ctrl+?. The macro opens an input form. I type Test1 the hit enter, the macro replaces the first "#" sign with "Test1", then moves to the next "#" sign. I type Test2 then hit enter, the macro replaces the second "#" sign with "Test2"....so on and so forth. This is what I coded the Macro to do, is this what you were looking for? If not, I can try making changes to suit your exact needs

Customer:

Ok I see what was happening - and it works but when I close the document (didn't save replace changes) and open it again - the macro is gone - have to start all over with importing from Visual Basic

ragankel0323 :

Once you import the Macro, try pressing the save button in Visual Basic.

Customer:

Its telling me it can't save unless I save it in a macro-enabled file type

ragankel0323 :

Yes...that's what you need to do

Customer:

Then I don't think this is going to work for me. We use an application that uses Word as a template which I can't change.

ragankel0323 :

What format does the fie need to be in?

ragankel0323 :

Currently, I am using the macro that I designed in a Word Doc that has the .docx file extension

Customer:

I honestly can't tell you that.

Customer:

Our reports are not save to Word files.

ragankel0323 :

But your files start out as Word files right?

Customer:

Our files are save to our application not in .docx

Customer:

I'm not the IT expert on where our files are saved - so I'm probably giving you misinformation. I really appreciate all your help.

ragankel0323 :

Well, now you have a Macro that you can use on other Word documents. ;-)

Customer:

Thanks again.

ragankel0323, Sr. Systems Analyst
Category: Computer
Satisfied Customers: 81
Experience: If it boots up, logs on, or has a touch screen, chances are I have the experience you are looking for :-).
ragankel0323 and 8 other Computer Specialists are ready to help you

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
< Last | Next >
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
  • I am very happy with my very fast response. Eric is very knowledgeable in the subject area. Thank you! RP Austin, TX
  • Hi John, Thank you for your expertise and, more important, for your kindness because they make me, almost, look forward to my next computer problem. After the next problem comes, I'll be delighted to correspond again with you. I'm told that I excel at programing. But system administration has never been one of my talents. So it's great to have an expert to rely on when the computer decides to stump me. God bless, Bill Bill M. Schenectady, New York
  • The Expert answered my Mac question and was patient. He answered in a thorough and timely manner, keeping the response on a level that could understand. Thank you! Frank Canada
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
 
 
 

Meet The Experts:

 
 
 
  • Andy

    Computer Consultant

    Satisfied Customers:

    5311
    11yr exp, Comp Engg, Internet expert, Web developer, SEO
< Last | Next >
  • http://ww2.justanswer.com/uploads/EN/Engineer1010/2012-6-9_132423_jaj12a.64x64.jpg Andy's Avatar

    Andy

    Computer Consultant

    Satisfied Customers:

    5311
    11yr exp, Comp Engg, Internet expert, Web developer, SEO
  • http://ww2.justanswer.com/uploads/BA/barrenrock/2011-10-19_215925_JamesJAFinal.64x64.jpg James's Avatar

    James

    Sr. Computer Support Expert

    Satisfied Customers:

    8376
    20 years of experience building, fixing and servicing PCs and operating systems.
  • http://ww2.justanswer.com/uploads/zeyank/2009-09-26_154244_P8110079.png Ryan H.'s Avatar

    Ryan H.

    Computer Support Specialist

    Satisfied Customers:

    1741
    A+ Certified Technician - 10 Years experience working with all types of computer systems.
  • http://ww2.justanswer.com/uploads/JA/jadedangel57/2011-11-8_193134_janenewsm.64x64.jpg Jane Lefler's Avatar

    Jane Lefler

    Sr Prog Analyst / Technician

    Satisfied Customers:

    0
    Computer Programmer / Technician/ Consultant 16+ years
  • http://ww2.justanswer.com/uploads/RO/robmpreston/2013-9-23_233814_mijiFZm.64x64.jpg RPI Solutions's Avatar

    RPI Solutions

    Support Specialist

    Satisfied Customers:

    3476
    5+ Years in IT, BS in Computer Science
  • http://ww2.justanswer.com/uploads/BA/barunrath/2012-7-5_201954_Profilepic2.64x64.jpg B. Rath's Avatar

    B. Rath

    Computer Support Specialist

    Satisfied Customers:

    8671
    Certified Computer/Networking Support Specialist.
  • http://ww2.justanswer.com/uploads/FS/fszcze/2012-6-18_181848_500test.64x64.jpg Frederick S.'s Avatar

    Frederick S.

    Computer Specialist

    Satisfied Customers:

    7240
    Computer technician and founder of a home PC repair company.
 
 
 
Chat Now With A Tech Support Specialist
ragankel0323
ragankel0323
Tech Support Specialist
81 Satisfied Customers
If it boots up, logs on, or has a touch screen, chances are I have the experience you are looking for :-).