Append code to a xlDialog

  • Thread starter Thread starter Kent Smith
  • Start date Start date
K

Kent Smith

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
 
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
******************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top