Solved

Word95 Macro style search returns "" in table

Posted on 1998-03-29
5
191 Views
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?
0
Comment
Question by:Lester032998
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:frazer
ID: 1611847
Hi,

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

Frazer
0
 

Author Comment

by:Lester032998
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"

StartOfDocument
' 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
0
 
LVL 3

Expert Comment

by:frazer
ID: 1611849
Hi,

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.

Thanks

Frazer
0
 
LVL 3

Accepted Solution

by:
frazer earned 100 total points
ID: 1611850
Hi,

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

Frazer
0
 

Author Comment

by:Lester032998
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.

Lester
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Some time ago I was asked to create a VBA function that would calculate a check digit for an input number, using the following procedure: First, sum up all the individual digits in the number If that sum value has more than one digit, then sum up …
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now