jayramaswamy
Programmer
Hello,
I am writing a Macro in which I defined a DropComboBox to list 4 reports. The user can select one report and clikc 'Ok' to view the report.
The following is the code and I am trying to get the selected recrod from the dopdowncombobox. How do I get the value from it ? Help will be highly appreciated. The following is the code.. . .
************8
'******************************************************************************
'*
'* Open Report.mac
'*
'******************************************************************************
Option Explicit
Sub main()
Dim objImpApp As Object
Dim strReport As String
Dim answer As Integer
Dim DropListBox1() As String
Const ReportPath = "C:\KPICatalog\"
Const ReportOne = "NationalOverview.imr"
Const ReportTwo = "OrderInfo-Main.imr"
Const ReportThree = "OrdersPerHour.imr"
Const ReportFour = "SalesOrderLine-Detail.imr"
Const ReportFive = "TotalSales-AllSites.imr"
On Error GoTo ErrorRoutine
Set objImpApp = CreateObject("Impromptu.Application")
'if Impromptu is not running visibly, end the macro
If objImpApp.Visible = True Then
'do nothing
Else
MsgBox "Please open Impromptu and run the macro again."
objImpApp.Quit
Set objIMpApp = Nothing
Exit Sub
End If
ReDim DropListBox1(4)
DropListBox1(0)= "Sales-National Overview"
DropListBox1(1)= "Orders-Main Report"
DropListBox1(2)= "Orders Per Hour"
DropListBox1(3)= "Sales Orders-Detail"
DropListBox1(4)= "Total Sales-All Sites"
Begin Dialog UserDialog 166, 100, "xxxxx, MI, USA"
Text 9, 3, 69, 13, "Reports:", .text1
DropListBox 9, 14, 97, 119, DropListBox1(), .DropListBox1
OKButton 115, 6, 45, 14
CancelButton 115, 26, 45, 14
End Dialog
Dim mydialogbox As UserDialog
answer= Dialog(mydialogbox)
if answer = -1 Then
MsgBox "You pressed OK" & "Sales-National Overview"
elseif answer = 0 Then
Goto Done
End If
'objImpApp.Activate
'Set objImpApp = Nothing
Done:
Exit Sub
ErrorRoutine:
MsgBox "Error Number: " & Err & " occurred at line " & Erl
Resume Done
End Sub
I am writing a Macro in which I defined a DropComboBox to list 4 reports. The user can select one report and clikc 'Ok' to view the report.
The following is the code and I am trying to get the selected recrod from the dopdowncombobox. How do I get the value from it ? Help will be highly appreciated. The following is the code.. . .
************8
'******************************************************************************
'*
'* Open Report.mac
'*
'******************************************************************************
Option Explicit
Sub main()
Dim objImpApp As Object
Dim strReport As String
Dim answer As Integer
Dim DropListBox1() As String
Const ReportPath = "C:\KPICatalog\"
Const ReportOne = "NationalOverview.imr"
Const ReportTwo = "OrderInfo-Main.imr"
Const ReportThree = "OrdersPerHour.imr"
Const ReportFour = "SalesOrderLine-Detail.imr"
Const ReportFive = "TotalSales-AllSites.imr"
On Error GoTo ErrorRoutine
Set objImpApp = CreateObject("Impromptu.Application")
'if Impromptu is not running visibly, end the macro
If objImpApp.Visible = True Then
'do nothing
Else
MsgBox "Please open Impromptu and run the macro again."
objImpApp.Quit
Set objIMpApp = Nothing
Exit Sub
End If
ReDim DropListBox1(4)
DropListBox1(0)= "Sales-National Overview"
DropListBox1(1)= "Orders-Main Report"
DropListBox1(2)= "Orders Per Hour"
DropListBox1(3)= "Sales Orders-Detail"
DropListBox1(4)= "Total Sales-All Sites"
Begin Dialog UserDialog 166, 100, "xxxxx, MI, USA"
Text 9, 3, 69, 13, "Reports:", .text1
DropListBox 9, 14, 97, 119, DropListBox1(), .DropListBox1
OKButton 115, 6, 45, 14
CancelButton 115, 26, 45, 14
End Dialog
Dim mydialogbox As UserDialog
answer= Dialog(mydialogbox)
if answer = -1 Then
MsgBox "You pressed OK" & "Sales-National Overview"
elseif answer = 0 Then
Goto Done
End If
'objImpApp.Activate
'Set objImpApp = Nothing
Done:
Exit Sub
ErrorRoutine:
MsgBox "Error Number: " & Err & " occurred at line " & Erl
Resume Done
End Sub