ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Append code to a xlDialog (https://www.excelbanter.com/excel-programming/323719-append-code-xldialog.html)

Kent Smith

Append code to a xlDialog
 
Hello - I'm trying to find a way to run a procedure in conjunction with a
specific common dialog routine. Specifically I want to run some code
immediately after the format axis / scale dialog. I guess I want something
like a dialog event procedure. Is it possible?
Thanks in advance...
-Kent



Kent Smith

Append code to a xlDialog
 
Hi Kent-
I assume you want to use the new "scale" data from the dialog in your
procedure. I think the Chart_Before_Double_Click with do the job. The
catch is that you have to replace the default dialog box with a duplicate.
Then you can put your code after the inputs from the dialog box are
received. You will then need to do a "cancel" to avoid getting the default
box.
The following code will help explain. Put it behind the chart you are
working with. The msgbox shows the paramenter values that are passed for the
selected object. You will want to get rid of that after you enter your
special code.

Private Sub Chart_BeforeDoubleClick(ByVal ElementID As Long, ByVal Arg1 As
Long, ByVal Arg2 As Long, Cancel As Boolean)
Dim myChart As Chart
Dim strMessage As String
Dim dAXIS_MIN As Double
Dim dAXIS_MAX As Double
Set myChart = Chart4 'use immediate window ?activechart.codename to
get codename.
strMessage = "Element ID = " & ElementID & vbCrLf
strMessage = strMessage & "Arg1 = " & Arg1 & vbCrLf
strMessage = strMessage & "Arg2 = " & Arg2
MsgBox (strMessage)
If ElementID = 21 Then '21 Indicates a "y" axis is selected
Application.CommandBars(48).Controls(1).Execute 'runs the 'format axis'
comand
If Arg1 = 1 Then 'primary axis is selected
PUT YOUR CODE HERE
End If
Cancel = True 'Avoids running default command.
End If
End Sub

I hope this helps.
Susie
******************
"Kent Smith" wrote in message
...
Hello - I'm trying to find a way to run a procedure in conjunction with a
specific common dialog routine. Specifically I want to run some code
immediately after the format axis / scale dialog. I guess I want
something like a dialog event procedure. Is it possible?
Thanks in advance...
-Kent





All times are GMT +1. The time now is 01:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com