LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.access
external usenet poster
 
Posts: 4,391
Default Ascertaining whether a search in VBA code returns a string or a reserved word

Paul,
You could check if the single line had a "Declare " and a " Lib " (note the
spaces) and compare text sensitive. Whilst not 100% conclusive, it would be
a pretty strange string to have both exactly like that.
Depending what you're after, maybe check it's not a comment first.

NickHK

"Paul Martin" wrote in message
ups.com...
Thanks all for your responses.

I'm using the Find method of CodeModule using the WholeWord argument as
True, so there's no problem capturing the various search criteria, and
this is very efficient. I was wondering if there's some way that VBA
(or an API) would recognise the use of the word as a reserved word or
otherwise.

Based on the responses I've received, the answer appears to be no. All
the solutions are based on capturing a code line as a string.


Dave Peterson wrote:

Can you look for it at the beginning of the line--after you trim any

leading
spaces (and ignoring Public/Private key words)?

And I think you'd have to make sure a space character followed it.

And you may have to count quotes to see if you're in a string.

Dim myStr as string
mystr = "Do you have anything to" & _
" declare"





Paul Martin wrote:

Hi all

I am writing some code that searches a VBA project for (in this case)
APIs and I am using "Declare" as the search criteria. If I find
"Declare", is there some way (perhaps an API) that can ascertain
whether the use of "Declare" is a string or a reserved word?

Now, I realise that if it is an API, it would be followed by

"Function"
or "Sub". I have other search criteria that I also need to look for
(such as "Shell" and ".RegisterDatabase").

Any suggestions appreciated. Thanks in advance.

Paul Martin
Melbourne, Australia


--

Dave Peterson




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding a single word match in a text string and assigning a code Morton Detwyler[_2_] Excel Worksheet Functions 6 September 15th 09 09:18 PM
A Macro to search a string in a Word file Farooq Sheri Excel Programming 2 January 27th 06 04:53 AM
search a string withing a string : find / search hangs itarnak[_9_] Excel Programming 4 October 24th 05 03:19 PM
Excel XP VBA code to search all macro code in Excel module for specific search string criteria Ed[_18_] Excel Programming 4 May 20th 04 02:08 PM
Excel XP VBA code to search all macro code in Excel module for specific search string criteria Frank Kabel Excel Programming 0 May 19th 04 08:11 PM


All times are GMT +1. The time now is 06:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"