Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro / Application Name

Status
Not open for further replies.

iwells

Programmer
Oct 2, 2012
284
CA
Hi All,

I can't seem to find a non-Excel/Sage applicable version of this question/answer, so I'm creating a post where I'd like to know how it's possible to programmatically determine the name of the project (located in the project explorer or tools-project properties-project name)?

I'm trying to do some general error logging and rather than hardcode/modify the project name in every project I'd rather just write a module and include it in each project that reads and assigns the project name to a Public variable I can reference in the error handling routine.

I've seen examples of VBE.ActiveVBProject.Name, but this doesn't seem to work in the Sage VBA editor ... suggestions?
 
In theory there's no difference between including a public const in your macro with the macro name/version/etc and setting that information in the project properties. If you use MZTools in your VBA IDE (highly recommended, btw) then you can customize an error trapping template to include your public const. MZTools is also available for VB, too.
 
As far as I know you cannot access Project Name - as well as a bunch of other stuff.

Sage 300 Certified Consultant
 
I have 4 macros (in reality I have like 100 different macros) I'm working with and what I'm trying to do is create a non-hardcoded way that when I create my error log text file it contains the project name, company, user, etc and I really didn't want to hard the project name as I go and update each of the outstanding macros, it would have been nice just to call something that would pass it my error logging.
 
Set a CONST. You either have to set the project name or a CONST in each macro, so it makes no difference which one you use - except that you can use CONST in your macro.

Sage 300 Certified Consultant
 
I'm setting the project name, how do I reference it though?
 
You cannot.
Use a CONST.

Sage 300 Certified Consultant
 
I wasn't clear in my response. I was trying to say that even if you could reference the project's properties in VBA there's no difference between doing those steps and including a const in your project.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top