Option Explicit
Sub AUTO_OPEN()
Dim oMenu As CommandBarPopup
Dim oItem As CommandBarPopup
Dim oSub1 As CommandBarButton
Dim oSub2 As CommandBarButton
Dim oSub3 As CommandBarButton
Dim oSub4 As CommandBarButton
Dim Msg, Style, Title
Dim InputSheet As Worksheet
Dim rng As Range
On Error GoTo ErrHandler
'do not prompt the user to save the file
Application.DisplayAlerts = False
Set oMenu = CommandBars("Worksheet Menu Bar").Controls("Data")
Set oItem = oMenu.Controls.Add(Type:=msoControlPopup, Temporary:=True)
oItem.Caption = "JDIS D&ata Extractor"
oItem.BeginGroup = True
' NOTE: setting of the CONTROL keys is really done in the XLS in the Macros Options
Set oSub1 = oItem.Controls.Add(Type:=msoControlButton, Temporary:=True)
'oSub1.Caption = "&Customer YTD Sales Inquiry Ctrl+T"
oSub1.OnAction = "CSTFM"
oSub1.Caption = "&Customer YTD Sales Inquiry"
oSub1.Control.ShortcutText = "Ctrl+T"
Set oSub2 = oItem.Controls.Add(Type:=msoControlButton, Temporary:=True)
'oSub2.Caption = "&Vendor Payment Group Detail Ctrl+Q"
oSub2.OnAction = "VendorPaymentGroupDetail"
oSub2.Caption = "&Vendor Payment Group Detail"
oSub2.Control.ShortcutText = "Ctrl+Q" ' NOTE: Q not in caption...
Set oSub3 = oItem.Controls.Add(Type:=msoControlButton, Temporary:=True)
'oSub3.Caption = "I&mport Extract Files Ctrl+M"
oSub3.OnAction = "ExtractFileDetail"
oSub3.Caption = "I&mport Extract Files"
oSub3.Control.ShortcutText = "Ctrl+M"
Set oSub4 = oItem.Controls.Add(Type:=msoControlButton, Temporary:=True)
'oSub4.Caption = "JDIS &Data Extractor User's Guide Ctrl+D"
oSub4.OnAction = "DEDOC"
oSub4.Caption = "JDIS &Data Extractor User's Guide"
oSub4.Control.ShortcutText = "Ctrl+D"
Set InputSheet = CreateInputSheet
On Error Resume Next
oSub1.FaceId = 17
oSub2.FaceId = 176
oSub3.FaceId = 265
oSub4.FaceId = 353
Exit Sub
ErrHandler:
Beep
Msg = CStr(Err.Description)
Style = vbOKOnly
Title = "JDIS Data Extractor - VBError"
MsgBox Msg, Style, Title
End Sub
Function CreateInputSheet() As Worksheet
Dim InpSheet As Worksheet
Dim countsheet As Integer
Dim rng As Range
Set InpSheet = Nothing
For countsheet = 1 To ActiveWorkbook.Sheets.Count
Set InpSheet = ActiveWorkbook.Sheets(countsheet)
If InpSheet.Name = "Inputs" Then
Exit For
Else
Set InpSheet = Nothing
End If
Next
If InpSheet Is Nothing Then
Set InpSheet = ActiveWorkbook.Worksheets.Add(After:=Worksheets(Worksheets.Count))
InpSheet.Name = "Inputs"
Set rng = InpSheet.Cells(1, 1)
rng.AddComment ("For Excel driven inquiries (Customer YTD Sales, Vendor Payment Group Detail, etc.), enter beginning value here")
Set rng = InpSheet.Range("A1")
rng.ColumnWidth = 12
Set rng = InpSheet.Range("B1")
rng.ColumnWidth = 12
Set rng = InpSheet.Range("C1")
rng.ColumnWidth = 100
InpSheet.Cells(6, 3) = "Notes:"
InpSheet.Cells(7, 3) = "1) JDIS Data Extractor Functionality is accessed from the Data -> JDIS Data Extractor menu options"
InpSheet.Cells(8, 3) = "2) Additional documentation is available from the Data -> JDIS Data Extractor -> JDIS Data Extractor User's Guide option"
InpSheet.Cells(9, 3) = "3) All cell data entry must be completed before executing any JDIS Data Extractor query"
InpSheet.Cells(11, 3) = "Customer YTD Sales Inquiry"
InpSheet.Cells(12, 3) = "1) Enter the customer numbers and / or customer ranges to be extracted"
InpSheet.Cells(13, 3) = " a) To enter a single customer number, enter the customer number in cell A1 on the spreadsheet"
InpSheet.Cells(14, 3) = " b) To enter a range of customer numbers, enter the beginning customer number in cell A1 and "
InpSheet.Cells(15, 3) = " enter the ending customer number in cell B1"
InpSheet.Cells(16, 3) = " c) Combinations of single customers and customer ranges may be entered within the same inquiry by"
InpSheet.Cells(17, 3) = " making similar entries in subsequent rows (A2 for an individual or A2 and B2 for a customer range, etc)"
InpSheet.Cells(18, 3) = "2) From the Data menu, select JDIS Data Extractor -> Customer YTD Sales Inquiry"
InpSheet.Cells(19, 3) = "3) If prompted with dialogs, fill out the appropriate Business System Info"
InpSheet.Cells(20, 3) = "4) Results will be displayed in the Results tab at the bottom of the Excel workbook"
InpSheet.Cells(22, 3) = "Vendor Payment Group Detail"
InpSheet.Cells(23, 3) = "1) Enter the vendor numbers and / or vendor ranges to be extracted"
InpSheet.Cells(24, 3) = " a) To enter a single vendor number, enter the vendor number in cell A1 on the spreadsheet"
InpSheet.Cells(25, 3) = " b) To enter a range of vendor numbers, enter the beginning customer number in cell A1 and "
InpSheet.Cells(26, 3) = " enter the ending vendor number in cell B1"
InpSheet.Cells(27, 3) = " c) Combinations of single vendors and vendor ranges may be entered within the same inquiry by"
InpSheet.Cells(28, 3) = " making similar entries in subsequent rows (A2 for an individual or A2 and B2 for a vendor range, etc)"
InpSheet.Cells(29, 3) = "2) From the Data menu, select JDIS Data Extractor -> Vendor Payment Group Detail"
InpSheet.Cells(30, 3) = "3) If prompted with dialogs, fill out the appropriate Business System Info"
InpSheet.Cells(31, 3) = "4) Results will be displayed in the Results tab at the bottom of the Excel workbook"
InpSheet.Cells(33, 3) = "Import Extract Files"
InpSheet.Cells(34, 3) = "1) Create ANY data extract file on your business system (See JDIS Data Extractor User's Guide for details)"
InpSheet.Cells(35, 3) = "2) From the Data menu, select JDIS Data Extractor -> Import Extract Files"
InpSheet.Cells(36, 3) = "3) When the file selection dialog box appears, enter the business system file name, from step # 1, to be imported"
InpSheet.Cells(37, 3) = "4) Results will be displayed in the Results tab at the bottom of the Excel worksheet"
Set rng = InpSheet.Range("C6")
rng.Font.Bold = True
rng.Interior.ColorIndex = 15
rng.BorderAround ColorIndex:=xlColorIndexAutomatic, Weight:=xlThin
Set rng = InpSheet.Range("C11")
rng.Font.Bold = True
rng.Interior.ColorIndex = 15
rng.BorderAround ColorIndex:=xlColorIndexAutomatic, Weight:=xlThin
Set rng = InpSheet.Range("C22")
rng.Font.Bold = True
rng.Interior.ColorIndex = 15
rng.BorderAround ColorIndex:=xlColorIndexAutomatic, Weight:=xlThin
Set rng = InpSheet.Range("C33")
rng.Font.Bold = True
rng.Interior.ColorIndex = 15
rng.BorderAround ColorIndex:=xlColorIndexAutomatic, Weight:=xlThin
Set rng = InpSheet.Range("A1")
With rng.EntireColumn.Validation
.Add Type:=xlValidateWholeNumber, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="1", Formula2:="9999999999"
'.InputTitle = "JDIS Data Extractor"
.ErrorTitle = "JDIS Data Extractor"
'.InputMessage = "Enter a valid customer"
.ErrorMessage = "Invalid customer number,valid customer number range 1-9999999999"
End With
Set rng = InpSheet.Range("B1")
With rng.EntireColumn.Validation
.Add Type:=xlValidateWholeNumber, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="1", Formula2:="9999999999"
'.InputTitle = "JDIS Data Extractor"
.ErrorTitle = "JDIS Data Extractor"
'.InputMessage = "Enter a valid customer"
.ErrorMessage = "Invalid customer number,valid customer number range 1-9999999999"
End With
End If
Set CreateInputSheet = InpSheet
End Function
--------------------
Bookmarks