1247467259
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
1247467259
Hi,
I'm getting an -1247467259 error when trying to run this line...
Application.VBE.CommandBars("Menu Bar") _
.Controls("Edit").Controls("Bookmarks").Controls("Toggle BookMark").Execute
I've had it before and for the life of me can't remember how I fixed it.
Any ideas??
I'm cross posting this on the code cage forums.
http://www.thecodecage.com/forumz/showt ... p?t=214737
TIA
Lisa
I'm getting an -1247467259 error when trying to run this line...
Application.VBE.CommandBars("Menu Bar") _
.Controls("Edit").Controls("Bookmarks").Controls("Toggle BookMark").Execute
I've had it before and for the life of me can't remember how I fixed it.
Any ideas??
I'm cross posting this on the code cage forums.
http://www.thecodecage.com/forumz/showt ... p?t=214737
TIA
Lisa
Last edited by LisaGreen on 12 Aug 2014, 11:12, edited 1 time in total.
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: 1247467259
Hi Lisa,
TX for the cross post info. Could I please ask that you edit your post to include a link to your post at Code Cage.
TX
TX for the cross post info. Could I please ask that you edit your post to include a link to your post at Code Cage.
TX
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: 1247467259
Hi,
I have never actively used bookmarks in the VBA, but I have noticed that the line of code runs fine while you are running the code within the VBA. If you run it from Excel, and the VBE is not the active window, then the line fails with the error you indicate.
I assume it is more of a debugging tool to allow you to easily navigate between procedures and modules while in the VBE. You can use the Edit toolbar in the VBE to set, remove and jump between the bookmarks. I'm not too sure in which context you are using the line of code you indicate.... ?
PS: Another trick you can use (if you do not use bookmarks), and as long as you have Option Explicit active in the modules of a project, is to just type blah...or any nonsense, and then compile your project...which will quickly take you back to the nonsense position. You can see these as temporary bookmarks.
I have never actively used bookmarks in the VBA, but I have noticed that the line of code runs fine while you are running the code within the VBA. If you run it from Excel, and the VBE is not the active window, then the line fails with the error you indicate.
I assume it is more of a debugging tool to allow you to easily navigate between procedures and modules while in the VBE. You can use the Edit toolbar in the VBE to set, remove and jump between the bookmarks. I'm not too sure in which context you are using the line of code you indicate.... ?
PS: Another trick you can use (if you do not use bookmarks), and as long as you have Option Explicit active in the modules of a project, is to just type blah...or any nonsense, and then compile your project...which will quickly take you back to the nonsense position. You can see these as temporary bookmarks.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: 1247467259
Hi Rudi,
Thank you for letting me know I needed a link! Duly edited.
I use bookmarks quite a bit. I have quite a few longish procedures in an add in and I often want to go to the start of the code. One of the add in procs is called subGoToTheBottomOfDims and er... moves the top of the window to the bottom of the dims... but first sets a bookmark to go back to.
I've often wanted to reset a set of breakpoints or to go to a particular one. Well you can't normally but if you set a bookmark with the breakpoint then you can.
The piece of code that I'm editing at the moment is meant to toggle a set of breakpoints/bookmarks and was working fine until recently. I've used the compile trick as well but it fails when there are other compile problems in the code :-(
The standard VBE bookmarks don't allow you to jump to a particular bookmark... you have to cycle around them. The code I'm writing collects all the bookmarks and addresses and allows you to go directly to any bookmark. I'm not too sure how far to take it though :-)
Lisa
Thank you for letting me know I needed a link! Duly edited.
I use bookmarks quite a bit. I have quite a few longish procedures in an add in and I often want to go to the start of the code. One of the add in procs is called subGoToTheBottomOfDims and er... moves the top of the window to the bottom of the dims... but first sets a bookmark to go back to.
I've often wanted to reset a set of breakpoints or to go to a particular one. Well you can't normally but if you set a bookmark with the breakpoint then you can.
The piece of code that I'm editing at the moment is meant to toggle a set of breakpoints/bookmarks and was working fine until recently. I've used the compile trick as well but it fails when there are other compile problems in the code :-(
The standard VBE bookmarks don't allow you to jump to a particular bookmark... you have to cycle around them. The code I'm writing collects all the bookmarks and addresses and allows you to go directly to any bookmark. I'm not too sure how far to take it though :-)
Lisa
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: 1247467259
Hi,
I found an answer in a previous code cage thread....
http://www.thecodecage.com/forumz/showthread.php?t=213302
Which points at...
http://support.microsoft.com/kb/2687441/en-us
However... that was a 32 bit system and this is a 64 bit one running 32 bit office and I can't get the thing to work this time.
Suggestions?
TIA
Lisa
I found an answer in a previous code cage thread....
http://www.thecodecage.com/forumz/showthread.php?t=213302
Which points at...
http://support.microsoft.com/kb/2687441/en-us
However... that was a 32 bit system and this is a 64 bit one running 32 bit office and I can't get the thing to work this time.
Suggestions?
TIA
Lisa
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: 1247467259
Thanks for the info. I must admit that I have never used the bookmark feature...even though some of the projects i set up have had multiple modules with multiple procedures. Its an interesting concept. :)
I was able to simulate the error you referred to when I ran the macro (containing the bookmark code line) from Excel. Then it debugged. The same macro when run from the VBE ran fine...so I deduced that the line is only valid if the VBE window is active. I further assume that if you have this code in macros you plan to run from Excel, then you would need to wrap it in On Error statements or use some decision logic to test if the VBE window is active....
OK...I see your reply.
I am not a member at Code Cage, so I cannot see the rest of that thread...
BTW: I am on Win 64 bit with 32 bit Office 2013.
I was able to simulate the error you referred to when I ran the macro (containing the bookmark code line) from Excel. Then it debugged. The same macro when run from the VBE ran fine...so I deduced that the line is only valid if the VBE window is active. I further assume that if you have this code in macros you plan to run from Excel, then you would need to wrap it in On Error statements or use some decision logic to test if the VBE window is active....
OK...I see your reply.
I am not a member at Code Cage, so I cannot see the rest of that thread...
BTW: I am on Win 64 bit with 32 bit Office 2013.
Last edited by Rudi on 12 Aug 2014, 12:03, edited 1 time in total.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78790
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: 1247467259
Lisa, the first link in your latest reply doesn't work correctly for me.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: 1247467259
Hi Hans,
Are you a member of the code cage? You probably can't read the post if not :-(
The second link is the important one really as it describes a workaround/solution.
I've stepped through it before and it fixed the problem completely. Not this time though... and though I dislike doing a system restore I've tried that as well without success. I'm trying to find out if there have been any problems with MS Updates at the moment as that seemed to have been the cause previously.
The fixed machine was a 32 bit system though and this is a 64 bit one and I suspect that that's the reason why that "fix" didn't work this time. I'm also looking into what Rudi said about the VBE window being active... though as you may know, the add in is for the VBE and a window should be active.
The code was working... as I think I mentioned... till quite recently.
Lisa
Are you a member of the code cage? You probably can't read the post if not :-(
The second link is the important one really as it describes a workaround/solution.
I've stepped through it before and it fixed the problem completely. Not this time though... and though I dislike doing a system restore I've tried that as well without success. I'm trying to find out if there have been any problems with MS Updates at the moment as that seemed to have been the cause previously.
The fixed machine was a 32 bit system though and this is a 64 bit one and I suspect that that's the reason why that "fix" didn't work this time. I'm also looking into what Rudi said about the VBE window being active... though as you may know, the add in is for the VBE and a window should be active.
The code was working... as I think I mentioned... till quite recently.
Lisa
-
- Administrator
- Posts: 78790
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: 1247467259
I don't know what happened - I can see the thread now, but not the replies because I'm not a member. Earlier today, however, I only saw some advertisements...
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: 1247467259
Hi Lisa,
I'm at a loss?
I can run that line of code without error within the VBE.
I'm not too sure what else to suggest?
What is happening at the point that this line debugs? Are you running an add-in for VBA? Are you stepping through code? Does the VBE window lose focus at any point of time? Can you fill in the gaps.
TX
I'm at a loss?
I can run that line of code without error within the VBE.
I'm not too sure what else to suggest?
What is happening at the point that this line debugs? Are you running an add-in for VBA? Are you stepping through code? Does the VBE window lose focus at any point of time? Can you fill in the gaps.
TX
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: 1247467259
Rudi and Hans....
Sometimes I think... actually more times than you'd think... "you stupid woman"... quote from allo allo.
In updating the bookmarks section of the program I'd broke something.
It's pretty short so here's the code for subGoTo...
subSetActiveProjectByName sets the active project by name :-) and fncGetFromBrackets gets the project name from Project(FileName).
I was passing it the wrong arguments so it didn't know where it was!! Rudi was sort of correct. I'd gotten the project and module name swapped around. It couldn't set the project because it was trying to set it to a module name and it couldn't go to the module either.
Everything works fine now... the code toggles the bookmarks as wanted now.... phew!!!!
So... a lesson learned... it wasn't Windows Update this time... and if there is a problem in the VBE then it cascades through called procedures. Didn't realize that. My thinking was that wherever the cursor ended up it should toggle a bookmark there but not so! The VBE lost it's way and just never got back.
Thanks for your help boys... you made me think hard enough to go back and look again in more detail.
If you want to check out the add in I'll be uploading the latest in a couple of days that includes the updated Bookmarks section. It's nice I think because you can choose which bookmark to go to rather than having to cycle around and gives an option to set breakpoints as well so you can go to a particular breakpoint. I mentioned that I don't know how far to go... I'm debating whether to give an option to set/unset a specific Bookmark or set of Bookmarks. Want me to let you know when I've uploaded? Or ... I could send you a copy if y'like.
Again... thanks for prompting me to think!!!
Hugs
Lisa
Sometimes I think... actually more times than you'd think... "you stupid woman"... quote from allo allo.
In updating the bookmarks section of the program I'd broke something.
It's pretty short so here's the code for subGoTo...
Code: Select all
Public Sub subGoTo( _
spProjectName As String, _
spModule As String, _
ipStartLine As Variant)
' Go to a place directly without looping
' through the projects to check names.
'
' Assumes Project = Project(FileName)
'
Dim lnglErrNumber As Integer
Dim olPane As Object
Dim vbcmlCodeModule As VBIDE.CodeModule
Dim vbclComponent As VBIDE.VBComponent
Dim vbplProject As VBIDE.VBProject
Dim slProjectName As String
subSetActiveProjectByName spProjectName
On Error Resume Next
Set vbplProject = Application.VBE.ActiveVBProject
slProjectName = fncGetFromBrackets(spProjectName)
Set vbclComponent = vbplProject.VBComponents(spModule)
Set vbcmlCodeModule = vbclComponent.CodeModule
vbclComponent.CodeModule.CodePane.Show
Set olPane = Application.VBE.ActiveCodePane
olPane.TopLine = ipStartLine
Application.VBE.ActiveCodePane.SetSelection ipStartLine, 1, ipStartLine, 1
lnglErrNumber = Err.Number
On Error GoTo 0
Set vbplProject = Nothing
Set vbclComponent = Nothing
Set vbcmlCodeModule = Nothing
Set olPane = Nothing
' ***********************************************************************
End Sub
I was passing it the wrong arguments so it didn't know where it was!! Rudi was sort of correct. I'd gotten the project and module name swapped around. It couldn't set the project because it was trying to set it to a module name and it couldn't go to the module either.
Everything works fine now... the code toggles the bookmarks as wanted now.... phew!!!!
So... a lesson learned... it wasn't Windows Update this time... and if there is a problem in the VBE then it cascades through called procedures. Didn't realize that. My thinking was that wherever the cursor ended up it should toggle a bookmark there but not so! The VBE lost it's way and just never got back.
Thanks for your help boys... you made me think hard enough to go back and look again in more detail.
If you want to check out the add in I'll be uploading the latest in a couple of days that includes the updated Bookmarks section. It's nice I think because you can choose which bookmark to go to rather than having to cycle around and gives an option to set breakpoints as well so you can go to a particular breakpoint. I mentioned that I don't know how far to go... I'm debating whether to give an option to set/unset a specific Bookmark or set of Bookmarks. Want me to let you know when I've uploaded? Or ... I could send you a copy if y'like.
Again... thanks for prompting me to think!!!
Hugs
Lisa
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: 1247467259
Hi Lisa,
If you are offering I won't reject as it provides an opportunity for me to try out bookmarks and see if I can add it to my usage of the app.
Welcome to let me know or inform me about your upload.
TX :)
If you are offering I won't reject as it provides an opportunity for me to try out bookmarks and see if I can add it to my usage of the app.
Welcome to let me know or inform me about your upload.
TX :)
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: 1247467259
Cool
Will do... no worries.
Will do... no worries.
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: 1247467259
Want what I have so far??Rudi wrote:Hi Lisa,
If you are offering I won't reject as it provides an opportunity for me to try out bookmarks and see if I can add it to my usage of the app.
Welcome to let me know or inform me about your upload.
TX :)
How do I send you a zip file Rudi... I'm very prepared to send what I have so far .... as long as you're gentle with me... :-) It's been a long time since I was "in the biz" and recognized as a "professional".
I have to say that it's being selfish though because I'll bite the arm off anyone who even *might* give any feedback!! LOL! In a lot of ways bad/critical comments are more productive.
Many hugs.. (I'm big on hugs!)...
Lisa
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: 1247467259
LOL...
I doubt I'll provide much useful feedback at all since I am not too familiar with code that runs inside the VBE. I can foresee my feedback being along the lines: "Wow...It's working great!" or "Oh no, now it's bookmarking my errors!!!" I'm more interested in the code for seeing if I can take advantage of bookmarks, as well as it could add to my knowledge of working with code for the VBE. (It's a whole set of objects I am not too familiar with). Like your hugs...I am big on learning
To answer your question...I'd prefer the end result. I'd probably not benefit too much from a project that is not entirely complete as I won't be able to do/edit much with only 3/4's of it. I wish you continued success in its development.
I doubt I'll provide much useful feedback at all since I am not too familiar with code that runs inside the VBE. I can foresee my feedback being along the lines: "Wow...It's working great!" or "Oh no, now it's bookmarking my errors!!!" I'm more interested in the code for seeing if I can take advantage of bookmarks, as well as it could add to my knowledge of working with code for the VBE. (It's a whole set of objects I am not too familiar with). Like your hugs...I am big on learning
To answer your question...I'd prefer the end result. I'd probably not benefit too much from a project that is not entirely complete as I won't be able to do/edit much with only 3/4's of it. I wish you continued success in its development.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Microsoft MVP
- Posts: 656
- Joined: 24 Jan 2010, 17:51
- Status: Microsoft MVP
- Location: Weert, The Netherlands
Re: 1247467259
Why not put what you have on OneDrive and share a link with us?
-
- 5StarLounger
- Posts: 964
- Joined: 08 Nov 2012, 17:54
Re: 1247467259
@Jan Karel... Now there's a thought. I'll check that out.
@Rudi... It's an ongoing project Rudi so will never be 100%. There's lots of code though.
You can read about it here.
http://www.thecodecage.com/forumz/view. ... vbacleanup
Hugs
Lisa
@Rudi... It's an ongoing project Rudi so will never be 100%. There's lots of code though.
You can read about it here.
http://www.thecodecage.com/forumz/view. ... vbacleanup
Hugs
Lisa
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: 1247467259
Quite a project! WOW!
Triple in size to my random data project that i uploaded here in the lounge.
It would be great to review the project and learn from it! I'll wait for the link if you are willing to share it.
Triple in size to my random data project that i uploaded here in the lounge.
It would be great to review the project and learn from it! I'll wait for the link if you are willing to share it.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.