i have the following:
Set objMyVbComp = Application.VBE.SelectedVBComponent
but if i check the ActiveWorkbook.Name, it is not the same.
how can i get the parent workbook from a selectedvbcomponent?
D
i have the following:
Set objMyVbComp = Application.VBE.SelectedVBComponent
but if i check the ActiveWorkbook.Name, it is not the same.
how can i get the parent workbook from a selectedvbcomponent?
D
orPlease Login or Register to view this content.
Please Login or Register to view this content.
Last edited by JEC.; 01-24-2022 at 03:39 PM.
JEC
Thanks for the contribution but it is not working in my code. let me show you:
does that make sense?Please Login or Register to view this content.
So where does it error? Did you already try the second option?
a little more info
I am running this from the immediate window.
i place my cursor in "CodeVerTest.xlsm" somewhere and go back to the immediate window and press enter.Please Login or Register to view this content.
In your example, it returned "CodeVerData.xlsm" (which is the source of the procedure), which is wrong. It should have returned "CodeVerTest.xlsm".
Does that help?
is there a way to .Parent.Name up to the workbook name?
A little help please.
I did find that this works in that it gets the VBProject name. how can i use that to get the workbook name
Please Login or Register to view this content.
Last edited by dmcgov; 01-25-2022 at 08:14 AM.
Filename is the property for the file name of the workbook with the specified project in it.
Remember what the dormouse said
Feed your head
Application.VBE.ActiveVBProject.VBComponents.Parent.Filename is the solution
Application.VBE.ActiveVBProject.VBComponents.Parent is just a very roundabout way of saying Application.VBE.ActiveVBProject
ah, another tidbit. wonderful. will make that edit to my code. btw, got a question on how to implement this in a userform. will post to a new thread.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks