Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need the ability to allow the user to change the cursor to a cross hair
that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Application.Cursor = xlDefault or...
-- HTH... Jim Thomlinson "gary" wrote: I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jim,
What I need is a full-form cross hair, not just a "+" sign cursor. The lines need to extend from the cursor position on the form to the horizontal and vertical edges of the form. I'm thinking some code will be required. Thanks, Gary "Jim Thomlinson" wrote: Application.Cursor = xlDefault or... -- HTH... Jim Thomlinson "gary" wrote: I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
Or if you only wish to track the mouse when a button is held down: Dim MoveCrossHairs As Boolean Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = xlPrimaryButton Then 'Or whichever button you wish to respond to MoveCrossHairs = True lblHoriz.Top = Y lblVert.Left = X End If End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If MoveCrossHairs Then lblHoriz.Top = Y lblVert.Left = X End If End Sub Private Sub UserForm_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) MoveCrossHairs = False End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Nick,
Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with Run time error Invalid class string which I think is due to the ie.label.lblHoriz not being the correct way to add a label control to the IE object. I dont know what would be correct. Also I dont know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend I can control scroll bars with: ..document.parentWindow.Scroll 100, 200 ..Visible = True Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") ..end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
The user form contains several controls to allow the user to specify what charts he wants to see in the IE window. Once I have the inputs I attempt to create an IE browser window and go to the URL that will get the desired info. I would like the cursor to change to cross hairs while it is over the IE window so the user can more accurately get values that are displayed along the borders. I hope that makes sense. Thanks for asking, Gary "NickHK" wrote: Gary, You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK "gary" wrote in message ... Nick, The user form contains several controls to allow the user to specify what charts he wants to see in the IE window. Once I have the inputs I attempt to create an IE browser window and go to the URL that will get the desired info. I would like the cursor to change to cross hairs while it is over the IE window so the user can more accurately get values that are displayed along the borders. I hope that makes sense. Thanks for asking, Gary "NickHK" wrote: Gary, You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. Gay "NickHK" wrote: Gary, But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK "gary" wrote in message ... Nick, The user form contains several controls to allow the user to specify what charts he wants to see in the IE window. Once I have the inputs I attempt to create an IE browser window and go to the URL that will get the desired info. I would like the cursor to change to cross hairs while it is over the IE window so the user can more accurately get values that are displayed along the borders. I hope that makes sense. Thanks for asking, Gary "NickHK" wrote: Gary, You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
Also, I tried awhile back to start up IE as a control on the UserForm without success. I got a licensing problem (This control could not be created because it is not properly licensed) when I tried to draw the control on the UsereForm. I have no idea what the problem is since I am the legal owner of my copy of Excel and VBA. Gary "gary" wrote: Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. Gay "NickHK" wrote: Gary, But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK "gary" wrote in message ... Nick, The user form contains several controls to allow the user to specify what charts he wants to see in the IE window. Once I have the inputs I attempt to create an IE browser window and go to the URL that will get the desired info. I would like the cursor to change to cross hairs while it is over the IE window so the user can more accurately get values that are displayed along the borders. I hope that makes sense. Thanks for asking, Gary "NickHK" wrote: Gary, You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
I'm no expert in this (or Excel for that matter..), but this now sounds like it has little to do Excel as such. Whilst you can reparent IE to your userform, I see no way to respond to mouse movements (without sub-classing or something). Also, how do you intend to draw your cross hairs ? I'm not clear on why you need to do this. You say "so the user can more accurately get values that are displayed along the borders". So what do "get values" mean ? NickHK "gary" wrote in message ... Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. Gay "NickHK" wrote: Gary, But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK "gary" wrote in message ... Nick, The user form contains several controls to allow the user to specify what charts he wants to see in the IE window. Once I have the inputs I attempt to create an IE browser window and go to the URL that will get the desired info. I would like the cursor to change to cross hairs while it is over the IE window so the user can more accurately get values that are displayed along the borders. I hope that makes sense. Thanks for asking, Gary "NickHK" wrote: Gary, You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#13
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
The reason for that may be the same reason as in the thread "MSFlexgrid in Excel" in this NG. I have VB6 installed so don't have that problem. NickHK "gary" wrote in message ... Nick, Also, I tried awhile back to start up IE as a control on the UserForm without success. I got a licensing problem (This control could not be created because it is not properly licensed) when I tried to draw the control on the UsereForm. I have no idea what the problem is since I am the legal owner of my copy of Excel and VBA. Gary "gary" wrote: Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. Gay "NickHK" wrote: Gary, But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK "gary" wrote in message ... Nick, The user form contains several controls to allow the user to specify what charts he wants to see in the IE window. Once I have the inputs I attempt to create an IE browser window and go to the URL that will get the desired info. I would like the cursor to change to cross hairs while it is over the IE window so the user can more accurately get values that are displayed along the borders. I hope that makes sense. Thanks for asking, Gary "NickHK" wrote: Gary, You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#14
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
OK, I was able to upgrade to VB 6 (still VBA part of Excel) and rewrote much of my code so the WebBrowser1 control now resides on my UserForm1. I also added a lblHoriz and lblVert to the UserFrom1 and did a send forward on each of them; I also did a send backward to the browser. Now the cross hairs move around the user form (I know how to adjust the length of the lines) but the cross hairs DO NOT go on top of the browser control which is where I need them. Any ideas? Thanks for your continued patience, Gary "NickHK" wrote: Gary, The reason for that may be the same reason as in the thread "MSFlexgrid in Excel" in this NG. I have VB6 installed so don't have that problem. NickHK "gary" wrote in message ... Nick, Also, I tried awhile back to start up IE as a control on the UserForm without success. I got a licensing problem (This control could not be created because it is not properly licensed) when I tried to draw the control on the UsereForm. I have no idea what the problem is since I am the legal owner of my copy of Excel and VBA. Gary "gary" wrote: Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. Gay "NickHK" wrote: Gary, But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK "gary" wrote in message ... Nick, The user form contains several controls to allow the user to specify what charts he wants to see in the IE window. Once I have the inputs I attempt to create an IE browser window and go to the URL that will get the desired info. I would like the cursor to change to cross hairs while it is over the IE window so the user can more accurately get values that are displayed along the borders. I hope that makes sense. Thanks for asking, Gary "NickHK" wrote: Gary, You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#15
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
One way is put the browser in a frame and disable the frame. You also disable the browser, but does the user need to interact with the browser ? NickHK "gary" wrote in message ... Nick, OK, I was able to upgrade to VB 6 (still VBA part of Excel) and rewrote much of my code so the WebBrowser1 control now resides on my UserForm1. I also added a lblHoriz and lblVert to the UserFrom1 and did a "send forward" on each of them; I also did a "send backward" to the browser. Now the cross hairs move around the user form (I know how to adjust the length of the lines) but the cross hairs DO NOT go on top of the browser control which is where I need them. Any ideas? Thanks for your continued patience, Gary "NickHK" wrote: Gary, The reason for that may be the same reason as in the thread "MSFlexgrid in Excel" in this NG. I have VB6 installed so don't have that problem. NickHK "gary" wrote in message ... Nick, Also, I tried awhile back to start up IE as a control on the UserForm without success. I got a licensing problem (This control could not be created because it is not properly licensed) when I tried to draw the control on the UsereForm. I have no idea what the problem is since I am the legal owner of my copy of Excel and VBA. Gary "gary" wrote: Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. Gay "NickHK" wrote: Gary, But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK "gary" wrote in message ... Nick, The user form contains several controls to allow the user to specify what charts he wants to see in the IE window. Once I have the inputs I attempt to create an IE browser window and go to the URL that will get the desired info. I would like the cursor to change to cross hairs while it is over the IE window so the user can more accurately get values that are displayed along the borders. I hope that makes sense. Thanks for asking, Gary "NickHK" wrote: Gary, You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#16
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
I tried what you suggested (Browser inside Frame that is disabled) but no difference. The cross hairs do not cover the frame either. The user might want to get control of the browser which I could accomodate with a button I could add on the UserForm. Gary "NickHK" wrote: Gary, I'm no expert in this (or Excel for that matter..), but this now sounds like it has little to do Excel as such. Whilst you can reparent IE to your userform, I see no way to respond to mouse movements (without sub-classing or something). Also, how do you intend to draw your cross hairs ? I'm not clear on why you need to do this. You say "so the user can more accurately get values that are displayed along the borders". So what do "get values" mean ? NickHK "gary" wrote in message ... Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. Gay "NickHK" wrote: Gary, But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK "gary" wrote in message ... Nick, The user form contains several controls to allow the user to specify what charts he wants to see in the IE window. Once I have the inputs I attempt to create an IE browser window and go to the URL that will get the desired info. I would like the cursor to change to cross hairs while it is over the IE window so the user can more accurately get values that are displayed along the borders. I hope that makes sense. Thanks for asking, Gary "NickHK" wrote: Gary, You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#17
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
That works for me. Sure you have Frame1.Enabled=False ? You can have a button to toggle the .Enabled state of the frame. NickHK "gary" wrote in message ... Nick, I tried what you suggested (Browser inside Frame that is disabled) but no difference. The cross hairs do not cover the frame either. The user might want to get control of the browser which I could accomodate with a button I could add on the UserForm. Gary "NickHK" wrote: Gary, I'm no expert in this (or Excel for that matter..), but this now sounds like it has little to do Excel as such. Whilst you can reparent IE to your userform, I see no way to respond to mouse movements (without sub-classing or something). Also, how do you intend to draw your cross hairs ? I'm not clear on why you need to do this. You say "so the user can more accurately get values that are displayed along the borders". So what do "get values" mean ? NickHK "gary" wrote in message ... Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. Gay "NickHK" wrote: Gary, But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK "gary" wrote in message ... Nick, The user form contains several controls to allow the user to specify what charts he wants to see in the IE window. Once I have the inputs I attempt to create an IE browser window and go to the URL that will get the desired info. I would like the cursor to change to cross hairs while it is over the IE window so the user can more accurately get values that are displayed along the borders. I hope that makes sense. Thanks for asking, Gary "NickHK" wrote: Gary, You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#18
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
Yes, I even added "Frame1.enabled = false" to no avail. The cross hairs go behind the frame. Any ideas ? "NickHK" wrote: Gary, That works for me. Sure you have Frame1.Enabled=False ? You can have a button to toggle the .Enabled state of the frame. NickHK "gary" wrote in message ... Nick, I tried what you suggested (Browser inside Frame that is disabled) but no difference. The cross hairs do not cover the frame either. The user might want to get control of the browser which I could accomodate with a button I could add on the UserForm. Gary "NickHK" wrote: Gary, I'm no expert in this (or Excel for that matter..), but this now sounds like it has little to do Excel as such. Whilst you can reparent IE to your userform, I see no way to respond to mouse movements (without sub-classing or something). Also, how do you intend to draw your cross hairs ? I'm not clear on why you need to do this. You say "so the user can more accurately get values that are displayed along the borders". So what do "get values" mean ? NickHK "gary" wrote in message ... Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. Gay "NickHK" wrote: Gary, But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK "gary" wrote in message ... Nick, The user form contains several controls to allow the user to specify what charts he wants to see in the IE window. Once I have the inputs I attempt to create an IE browser window and go to the URL that will get the desired info. I would like the cursor to change to cross hairs while it is over the IE window so the user can more accurately get values that are displayed along the borders. I hope that makes sense. Thanks for asking, Gary "NickHK" wrote: Gary, You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#19
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
gary,
Sorry, forgot I had changed the 2 x labels to 2 x frames. Also, make sure the frame containing the browser is behind the 2 frames; right-click on the frame's border and "Send Backward". "gary" wrote in message ... Nick, Yes, I even added "Frame1.enabled = false" to no avail. The cross hairs go behind the frame. Any ideas ? "NickHK" wrote: Gary, That works for me. Sure you have Frame1.Enabled=False ? You can have a button to toggle the .Enabled state of the frame. NickHK "gary" wrote in message ... Nick, I tried what you suggested (Browser inside Frame that is disabled) but no difference. The cross hairs do not cover the frame either. The user might want to get control of the browser which I could accomodate with a button I could add on the UserForm. Gary "NickHK" wrote: Gary, I'm no expert in this (or Excel for that matter..), but this now sounds like it has little to do Excel as such. Whilst you can reparent IE to your userform, I see no way to respond to mouse movements (without sub-classing or something). Also, how do you intend to draw your cross hairs ? I'm not clear on why you need to do this. You say "so the user can more accurately get values that are displayed along the borders". So what do "get values" mean ? NickHK "gary" wrote in message ... Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. Gay "NickHK" wrote: Gary, But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK "gary" wrote in message ... Nick, The user form contains several controls to allow the user to specify what charts he wants to see in the IE window. Once I have the inputs I attempt to create an IE browser window and go to the URL that will get the desired info. I would like the cursor to change to cross hairs while it is over the IE window so the user can more accurately get values that are displayed along the borders. I hope that makes sense. Thanks for asking, Gary "NickHK" wrote: Gary, You've lost me now. You are creating an instance of Internet Explorer at run time, but I do not see the connection between that and the userform. You can place a web browser on a userform using the "Microsoft web Browser" control. You then want to put cross hairs over that ? Is that what you are after ? NickHK "gary" wrote in message ... Hi Nick, Your solution is very elegant. All I had to add was to set the label border style to 1 (single line) so I could see the lines. It does exactly what I asked. (Single one). What I am actually trying to do is add cross hairs to an IE object set with the following code. The Addlabel dies at runtime with "Run time error Invalid class string" which I think is due to the " ie.label.lblHoriz" not being the correct way to add a label control to the IE object. I don't know what would be correct. Also I don't know how to make the correct event handler for the mouse move event while the mouse is on the IE form. Any ideas? Dim ie as Object Sub Addlabel(strControl As String, intLeft As Integer, intTop As Integer, intWidth As Integer, intHeight As Integer, strCaption As String) Dim mycmd As Control Set mycmd = Controls.Add(strControl) mycmd.Left = intLeft mycmd.Top = intTop mycmd.Width = intWidth mycmd.Height = intHeight mycmd.BorderStyle = 1 If strCaption < "" Then mycmd.Caption = strCaption End If mycmd.Visible = True End Sub ' ' not sure about this ' Private Sub ie_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With set ie = CreateObject("InternetExplorer.Application") ie.AddressBar = False ie.MenuBar = False ie.Toolbar = False ie.Width = 600 ie.Height = 750 ie.Left = 0 ie.Top = 0 ie.navigate "www.yahoo.com" With ie While Not .readyState = READYSTATE_COMPLETE DoEvents Wend ' I can control scroll bars with: .document.parentWindow.Scroll 100, 200 .Visible = True 'Add cross hairs here --NOT CORRECT Call UserForm1.Addlabel( "ie.label.lblHoriz",2, 10, 175, 20, "") Call UserForm1.Addlabel( " ie.label.lblVert",2, 20, 175, 20, "") .end with "NickHK" wrote: Gary, On a userform with 2 labels, lblHoriz and lblVert: Private Sub UserForm_Initialize() With lblHoriz .Height = 1 .Left = 0 .Width = Me.Width End With With lblVert .Width = 1 .Top = 0 .Height = Me.Height End With End Sub Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) lblHoriz.Top = Y lblVert.Left = X End Sub NickHK "gary" wrote in message ... I need the ability to allow the user to change the cursor to a cross hair that covers the entire form that detected the mouse event. This is needed so user can read values along sides and bottom of form as he/she moves mouse over the form. I have been unable to find any vba code to do this. Gary |
#20
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
I reread your last reply and you said I needed to disable the browser as well as the Frame. How do I disable the browser ? I'm suspicious becaue the cross hairs in no way cover the frame right now. Gary "gary" wrote: Nick, I tried what you suggested (Browser inside Frame that is disabled) but no difference. The cross hairs do not cover the frame either. The user might want to get control of the browser which I could accomodate with a button I could add on the UserForm. Gary "NickHK" wrote: Gary, I'm no expert in this (or Excel for that matter..), but this now sounds like it has little to do Excel as such. Whilst you can reparent IE to your userform, I see no way to respond to mouse movements (without sub-classing or something). Also, how do you intend to draw your cross hairs ? I'm not clear on why you need to do this. You say "so the user can more accurately get values that are displayed along the borders". So what do "get values" mean ? NickHK "gary" wrote in message ... Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. |
#21
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
No need to disable the browser as it's container (the frame) is disabled. Did you replace the cross hair labels with frames ? And ensure the browser's frame is furthest backward ? NickHK "gary" wrote in message ... Nick, I reread your last reply and you said I needed to disable the browser as well as the Frame. How do I disable the browser ? I'm suspicious becaue the cross hairs in no way cover the frame right now. Gary "gary" wrote: Nick, I tried what you suggested (Browser inside Frame that is disabled) but no difference. The cross hairs do not cover the frame either. The user might want to get control of the browser which I could accomodate with a button I could add on the UserForm. Gary "NickHK" wrote: Gary, I'm no expert in this (or Excel for that matter..), but this now sounds like it has little to do Excel as such. Whilst you can reparent IE to your userform, I see no way to respond to mouse movements (without sub-classing or something). Also, how do you intend to draw your cross hairs ? I'm not clear on why you need to do this. You say "so the user can more accurately get values that are displayed along the borders". So what do "get values" mean ? NickHK "gary" wrote in message ... Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. |
#22
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
Yes yes !! The cross hairs now move on top of the browser !! One last (I hope) question. How do I control the scroll bar positions in WebBrowseer1 from my vba program. I used to control the IE browser object with ie.document.parentWindow.Scroll horiz, vert Thanks for your help, Gary "NickHK" wrote: gary, Sorry, forgot I had changed the 2 x labels to 2 x frames. Also, make sure the frame containing the browser is behind the 2 frames; right-click on the frame's border and "Send Backward". "gary" wrote in message ... Nick, Yes, I even added "Frame1.enabled = false" to no avail. The cross hairs go behind the frame. Any ideas ? "NickHK" wrote: Gary, That works for me. Sure you have Frame1.Enabled=False ? You can have a button to toggle the .Enabled state of the frame. NickHK "gary" wrote in message ... Nick, I tried what you suggested (Browser inside Frame that is disabled) but no difference. The cross hairs do not cover the frame either. The user might want to get control of the browser which I could accomodate with a button I could add on the UserForm. Gary "NickHK" wrote: Gary, I'm no expert in this (or Excel for that matter..), but this now sounds like it has little to do Excel as such. Whilst you can reparent IE to your userform, I see no way to respond to mouse movements (without sub-classing or something). Also, how do you intend to draw your cross hairs ? I'm not clear on why you need to do this. You say "so the user can more accurately get values that are displayed along the borders". So what do "get values" mean ? NickHK "gary" wrote in message ... Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. Gay "NickHK" wrote: Gary, But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK |
#23
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
Looks like it's the same. NickHk "gary" wrote in message ... Nick, Yes yes !! The cross hairs now move on top of the browser !! One last (I hope) question. How do I control the scroll bar positions in WebBrowseer1 from my vba program. I used to control the IE browser object with ie.document.parentWindow.Scroll horiz, vert Thanks for your help, Gary "NickHK" wrote: gary, Sorry, forgot I had changed the 2 x labels to 2 x frames. Also, make sure the frame containing the browser is behind the 2 frames; right-click on the frame's border and "Send Backward". "gary" wrote in message ... Nick, Yes, I even added "Frame1.enabled = false" to no avail. The cross hairs go behind the frame. Any ideas ? "NickHK" wrote: Gary, That works for me. Sure you have Frame1.Enabled=False ? You can have a button to toggle the .Enabled state of the frame. NickHK "gary" wrote in message ... Nick, I tried what you suggested (Browser inside Frame that is disabled) but no difference. The cross hairs do not cover the frame either. The user might want to get control of the browser which I could accomodate with a button I could add on the UserForm. Gary "NickHK" wrote: Gary, I'm no expert in this (or Excel for that matter..), but this now sounds like it has little to do Excel as such. Whilst you can reparent IE to your userform, I see no way to respond to mouse movements (without sub-classing or something). Also, how do you intend to draw your cross hairs ? I'm not clear on why you need to do this. You say "so the user can more accurately get values that are displayed along the borders". So what do "get values" mean ? NickHK "gary" wrote in message ... Nick, The IE browser is completely separate from the User Form. The code to control the browser resides on the user form which is kicked off from excel after the user has set several parameters. So besides needing to put cross hairs on the IE browser, the cross hairs need to be responsive to mouse movements on the browser. Gay "NickHK" wrote: Gary, But you are attempting to draw cross hairs on IE that is completely separated from your userform and Excel ? Or you do have a web browser control on your userform ? NickHK |
#24
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
Sorry about the duplicate message but my connection timed out. Anyway, I see the scrollbars are part of the frame that contains the browser. I can manually move the scroll bars and the chart in the browser responds. What I need is to be able to send a command from vba to do this. The following code appears to do nothing (but it compiles). FrameWeb.Enabled = True ' True so scroll bars can move (at least manually) With FrameWeb .ScrollBars = fmScrollBarsBoth .ScrollTop = Horiz .ScrollWidth = FVert End With Gary "NickHK" wrote: Gary, Looks like it's the same. NickHk "gary" wrote in message ... Nick, Yes yes !! The cross hairs now move on top of the browser !! One last (I hope) question. How do I control the scroll bar positions in WebBrowseer1 from my vba program. I used to control the IE browser object with ie.document.parentWindow.Scroll horiz, vert Thanks for your help, Gary |
#25
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
Why not just size the browser control to fit the frame and scroll the browser if needed. NickHK "gary" wrote in message ... Nick, Sorry about the duplicate message but my connection timed out. Anyway, I see the scrollbars are part of the frame that contains the browser. I can manually move the scroll bars and the chart in the browser responds. What I need is to be able to send a command from vba to do this. The following code appears to do nothing (but it compiles). FrameWeb.Enabled = True ' True so scroll bars can move (at least manually) With FrameWeb .ScrollBars = fmScrollBarsBoth .ScrollTop = Horiz .ScrollWidth = FVert End With Gary "NickHK" wrote: Gary, Looks like it's the same. NickHk "gary" wrote in message ... Nick, Yes yes !! The cross hairs now move on top of the browser !! One last (I hope) question. How do I control the scroll bar positions in WebBrowseer1 from my vba program. I used to control the IE browser object with ie.document.parentWindow.Scroll horiz, vert Thanks for your help, Gary |
#26
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
I already have the browser occupying the entire frame but there is stil stuff in the browser that does not normally need to be viewed (chart parameters whcih I am already sending to the URL). I know the browser will ALWAYS have to be scrolled because the charts have stuff at the top and left side that needs to be skipped. It would be nice for the user to be able to concentrate on the charts with minimal adjustment. Gary "NickHK" wrote: Gary, Why not just size the browser control to fit the frame and scroll the browser if needed. NickHK "gary" wrote in message ... Nick, Sorry about the duplicate message but my connection timed out. Anyway, I see the scrollbars are part of the frame that contains the browser. I can manually move the scroll bars and the chart in the browser responds. What I need is to be able to send a command from vba to do this. The following code appears to do nothing (but it compiles). FrameWeb.Enabled = True ' True so scroll bars can move (at least manually) With FrameWeb .ScrollBars = fmScrollBarsBoth .ScrollTop = Horiz .ScrollWidth = FVert End With Gary "NickHK" wrote: Gary, Looks like it's the same. NickHk "gary" wrote in message ... Nick, Yes yes !! The cross hairs now move on top of the browser !! One last (I hope) question. How do I control the scroll bar positions in WebBrowseer1 from my vba program. I used to control the IE browser object with ie.document.parentWindow.Scroll horiz, vert Thanks for your help, Gary |
#27
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
Never had the need to scroll on a VBA frame before. Seems like you have react to the Frame1_Scroll event with something like wb.Top=wb.Top+RequestDy but it all seems a strange implemetation to me. NickHK "gary" wrote in message ... Nick, I already have the browser occupying the entire frame but there is stil stuff in the browser that does not normally need to be viewed (chart parameters whcih I am already sending to the URL). I know the browser will ALWAYS have to be scrolled because the charts have stuff at the top and left side that needs to be skipped. It would be nice for the user to be able to concentrate on the charts with minimal adjustment. Gary "NickHK" wrote: Gary, Why not just size the browser control to fit the frame and scroll the browser if needed. NickHK "gary" wrote in message ... Nick, Sorry about the duplicate message but my connection timed out. Anyway, I see the scrollbars are part of the frame that contains the browser. I can manually move the scroll bars and the chart in the browser responds. What I need is to be able to send a command from vba to do this. The following code appears to do nothing (but it compiles). FrameWeb.Enabled = True ' True so scroll bars can move (at least manually) With FrameWeb .ScrollBars = fmScrollBarsBoth .ScrollTop = Horiz .ScrollWidth = FVert End With Gary "NickHK" wrote: Gary, Looks like it's the same. NickHk "gary" wrote in message ... Nick, Yes yes !! The cross hairs now move on top of the browser !! One last (I hope) question. How do I control the scroll bar positions in WebBrowseer1 from my vba program. I used to control the IE browser object with ie.document.parentWindow.Scroll horiz, vert Thanks for your help, Gary |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
cross hair | Excel Discussion (Misc queries) | |||
Row Column Cross Hair | Excel Worksheet Functions | |||
How do I change the cursor from cross to arrow | Excel Discussion (Misc queries) | |||
HOW DO I CHANGE THE EXCEL CURSOR TO AN ARROW FROM A CROSS ? | Excel Worksheet Functions | |||
Can I change the "white cross" cursor in Excel to another cursor? | Excel Discussion (Misc queries) |