473,537 Members | 2,796 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to navigate to specific procedure in a module or class module

Seth Schrock
2,965 Recognized Expert Specialist
Thanks to TheSmileyCoder's Access Crash Reporter, I get an email when an error occurs in my database. Part of the information in the email is the name of the module/class module and the name of the procedure in which the error occurred. I would like to be able to copy this information into a procedure that would take me to the specified procedure.

I already have the code in place to take the string "Error 52 has occured in procedure [AttachFile] in module [modTreeView] on line [60] on the following code:" and get the module and procedure name from that (using RegEx), but now I'm stuck on how to go to that place in my code. If the module is a regular module and not a form's class module, then I can use the DoCmd.OpenModule command, but it errors out saying that it can't find the module if I try to use it to open a form's class module.
Aug 12 '15 #1
4 1518
jforbes
1,107 Recognized Expert Top Contributor
Something like this might get you close...
Expand|Select|Wrap|Line Numbers
  1. Application.VBE.VBProjects(1).VBComponents("Form_FormName").CodeModule.CodePane.Show
or
Expand|Select|Wrap|Line Numbers
  1. Application.VBE.ActiveVBProject.VBComponents("Form_FormName").CodeModule.CodePane.Show
Aug 12 '15 #2
Seth Schrock
2,965 Recognized Expert Specialist
That opens the module perfectly, but now I need to go to the procedure. Any ideas?
Aug 12 '15 #3
Seth Schrock
2,965 Recognized Expert Specialist
Never mind. I found it.
Expand|Select|Wrap|Line Numbers
  1.     Dim lngStartLine As Long
  2.     With Application.VBE.ActiveVBProject.VBComponents(strModule).CodeModule
  3.         .codepane.Show
  4.         lngStartLine = .ProcStartLine(strProcedure, vbext_pk_Proc)
  5.         .codepane.SetSelection lngStartLine, 1, lngStartLine, 1
  6.     End With
Aug 12 '15 #4
jforbes
1,107 Recognized Expert Top Contributor
That is pretty neat.
Aug 12 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

42
4902
by: WindAndWaves | last post by:
Dear All Can you tell me why you use a class module??? Thank you Nicolaas ---
2
1418
by: windandwaves | last post by:
Hi Gurus I have a module with a bunch of functions that tell me everything about a table (e.g. the number of children, whether it exists, the table description, etc..., data-entry quality, etc...) It would make sense to actually change this module into a class module, because then, when I program, I can use the "autocomplete" function. ...
4
13888
by: Brad Parks | last post by:
Are there any performance or memory-usage benefits of placing public functions and subroutines in a Class Module rather than a standard module?
17
1723
by: chris.atlee | last post by:
Hi there, I haven't seen this topic pop up in a while, so I thought I'd raise it again... What is the status of the path module/class PEP? Did somebody start writing one, or did it die? I would really like to see something like Jason Orendorff's path class make its way into the python standard library.
2
1428
by: ApexData | last post by:
Hello I'm sure the solution is simple and probably has something to do with the VB Editor. I want to create an EventProcedure link to an already created procedure that exists in my Form Code. I plan to use this procedure more than one time. I can't figure out how to get OnUpdate to reference or PointTo this procedure. I keep creating...
6
4007
by: JonathanOrlev | last post by:
Hello everyone, I have a newbe question: In Access (2003) VBA, what is the difference between a Module and a Class Module in the VBA development environment? If I remember correctly, new types of objects (classes) can only be defined in Class modules.
7
3047
by: Brad Pears | last post by:
I am developing a simple error message class and would like the be able to generate as part of the message the curent class/module/form and function or sub that the error was generated in without having to hardcode this info to be passed to the error message class. I can get the stack trace using system.environment.stacktrace - but this is too...
0
25497
ADezii
by: ADezii | last post by:
The motivation for this Tip was a question asked by one of our Resident Experts, FishVal. The question was: How to Declare Default Method/Property in a Class Module? My response to the question was inadequate to say the least, but I was determined to come up with the correct answer, especially since my primary background is Visual Basic, and I...
8
5145
by: RojK | last post by:
Hi, I have a userform which has some command buttons and multiple listboxes in VBA. I have a class module which handles events on the form, and a code in the form's initialization section which sets the reference to the class module (depending on which control is clicked). What I am struggling with, is as follows: When the user clicks...
0
7361
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7298
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7531
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7683
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7642
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5218
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1757
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.