[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


Word95 Macro style search returns "" in table

Posted on 1998-03-29
Medium Priority
Last Modified: 2006-11-17
If I search for a style using a macro and then examine the contents of the selected text the resultant field contains blank when the style is found to be in a table but it does contain the correct data when it is found in the main body of the document. Any ideas?
Question by:Lester032998
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Expert Comment

ID: 1611847

Can you post the code, that should enable me to tell where the problem is.


Author Comment

ID: 1611848
Hi Fazer,

As requested the portion of code that is causing the problem !  (I have adapted the code from a macro written for Winfax.. If you hadn't already noticed :-) )


fax$ =  "wfxFaxNum"

' Find recipent's Fax Number. (No FaxNumber, No DDE Send!!)
On Error Goto bye
EditFindStyle .Style = fax$
EditFind .Find = "", .WholeWord = 0, .MatchCase = 0, .Direction = 0, \
      .Format = 1
If EditFindFound() <> - 1 Then Goto bye
faxnum$ = Chr$(34) + Selection$()  + Chr$(34)

Should enclose the selected text in quotes ready for DDE

Expert Comment

ID: 1611849

Which version of word are you using?

could you also post all the code as i am hoping it will give me a better understanding of your problem.



Accepted Solution

frazer earned 300 total points
ID: 1611850

I just noticed the answer to my question is in the title.....Doh!!!

I think you need to make the following adjustments

1)In the line
faxnum$ = Chr$(34) + Selection$()  + Chr$(34)

replace the "+'s" with &

2)In the line
EditFind .Find = "", .WholeWord = 0, .MatchCase = 0, .Direction = 0, \

replace the \ with _

3)Remove all occurances of $
I think it may be confusing VBA

These changes will probably reveal other errors.
Let me know what they are if and when they occur.

Hope this helps


Author Comment

ID: 1611851
Thanks Frazer, works fine now, but it still remains a mystery why it worked for the body but not for the table. In any case I can not reproduce the error even when I reset the macro back to it's original syntax. So although you were intumental in solving this puzzle, I think that it may have solved itself without any other intervention other than the usual MS response "Switch off & on again".

Thanks anyway you earned your points.

BTW you can email me at LesterSK@aol.com to arrange a chat  ... should you so desire.


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question