excelperfect 标簽:VBA Excel有261個内置對話框,使用這些現有的對話框,可以使編寫代碼更加容易。 例如,下面的代碼顯示内置的“打印”對話框。 Dim tmp As Boolean Application.Dialogs(xlDialogPrint).Show tmp =Application.Dialogs(xlDialogPrint).Show 如下圖1所示。 圖1 又如,下面的3行代碼都顯示“另存為”對話框: Application.Dialogs(xlDialogSaveAs).Show Application.Dialogs(XlBuiltInDialog.xlDialogSaveAs).Show Application.Dialogs(5).Show 如下圖2所示。 圖2 我們可以使用對話框中的所有功能,使用内置對話框可以節省大量編程工作。 在VBA對象浏覽器中,我們可以找到所有的内置對話框列表。打開VBE,按F2鍵打開對象浏覽器,在頂部的下拉列表框中選擇“Excel”,搜索“XlBuiltInDialog”,顯示所有内置對話框成員列表,如下圖3所示。 圖3 使用下面的程序将這些内置常量輸入到Excel工作表中,便于查閱。
Sub xlDialogList()
Dim i As Integer
Dim xlDialog(1 To 261, 1 To 2) As String
xlDialog(1, 1) = 103
xlDialog(2, 1) = 476
xlDialog(3, 1) = 390
xlDialog(4, 1) = 321
xlDialog(5, 1) = 43
xlDialog(6, 1) = 133
xlDialog(7, 1) = 212
xlDialog(8, 1) = 170
xlDialog(9, 1) = 171
xlDialog(10, 1) = 12
xlDialog(11, 1) = 213
xlDialog(12, 1) = 293
xlDialog(13, 1) = 80
xlDialog(14, 1) = 323
xlDialog(15, 1) = 485
xlDialog(16, 1) = 78
xlDialog(17, 1) = 45
xlDialog(18, 1) = 32
xlDialog(19, 1) = 46
xlDialog(20, 1) = 166
xlDialog(21, 1) = 392
xlDialog(22, 1) = 527
xlDialog(23, 1) = 724
xlDialog(24, 1) = 505
xlDialog(25, 1) = 506
xlDialog(26, 1) = 540
xlDialog(27, 1) = 350
xlDialog(28, 1) = 526
xlDialog(29, 1) = 288
xlDialog(30, 1) = 435
xlDialog(31, 1) = 52
xlDialog(32, 1) = 161
xlDialog(33, 1) = 47
xlDialog(34, 1) = 73
xlDialog(35, 1) = 583
xlDialog(36, 1) = 191
xlDialog(37, 1) = 147
xlDialog(38, 1) = 108
xlDialog(39, 1) = 796
xlDialog(40, 1) = 62
xlDialog(41, 1) = 217
xlDialog(42, 1) = 1272
xlDialog(43, 1) = 276
xlDialog(44, 1) = 493
xlDialog(45, 1) = 36
xlDialog(46, 1) = 379
xlDialog(47, 1) = 723
xlDialog(48, 1) = 40
xlDialog(49, 1) = 525
xlDialog(50, 1) = 61
xlDialog(51, 1) = 229
xlDialog(52, 1) = 111
xlDialog(53, 1) = 110
xlDialog(54, 1) = 203
xlDialog(55, 1) = 27
xlDialog(56, 1) = 862
xlDialog(57, 1) = 438
xlDialog(58, 1) = 223
xlDialog(59, 1) = 54
xlDialog(60, 1) = 251
xlDialog(61, 1) = 228
xlDialog(62, 1) = 463
xlDialog(63, 1) = 464
xlDialog(64, 1) = 732
xlDialog(65, 1) = 709
xlDialog(66, 1) = 530
xlDialog(67, 1) = 35
xlDialog(68, 1) = 6
xlDialog(69, 1) = 481
xlDialog(70, 1) = 200
xlDialog(71, 1) = 301
xlDialog(72, 1) = 447
xlDialog(73, 1) = 370
xlDialog(74, 1) = 475
xlDialog(75, 1) = 26
xlDialog(76, 1) = 381
xlDialog(77, 1) = 269
xlDialog(78, 1) = 465
xlDialog(79, 1) = 423
xlDialog(80, 1) = 150
xlDialog(81, 1) = 88
xlDialog(82, 1) = 225
xlDialog(83, 1) = 128
xlDialog(84, 1) = 42
xlDialog(85, 1) = 226
xlDialog(86, 1) = 129
xlDialog(87, 1) = 89
xlDialog(88, 1) = 64
xlDialog(89, 1) = 63
xlDialog(90, 1) = 130
xlDialog(91, 1) = 450
xlDialog(92, 1) = 193
xlDialog(93, 1) = 272
xlDialog(94, 1) = 194
xlDialog(95, 1) = 195
xlDialog(96, 1) = 196
xlDialog(97, 1) = 273
xlDialog(98, 1) = 67
xlDialog(99, 1) = 68
xlDialog(100, 1) = 69
xlDialog(101, 1) = 388
xlDialog(102, 1) = 344
xlDialog(103, 1) = 70
xlDialog(104, 1) = 71
xlDialog(105, 1) = 249
xlDialog(106, 1) = 72
xlDialog(107, 1) = 198
xlDialog(108, 1) = 76
xlDialog(109, 1) = 666
xlDialog(110, 1) = 55
xlDialog(111, 1) = 596
xlDialog(112, 1) = 259
xlDialog(113, 1) = 342
xlDialog(114, 1) = 380
xlDialog(115, 1) = 438
xlDialog(116, 1) = 437
xlDialog(117, 1) = 382
xlDialog(118, 1) = 470
xlDialog(119, 1) = 339
xlDialog(120, 1) = 378
xlDialog(121, 1) = 85
xlDialog(122, 1) = 185
xlDialog(123, 1) = 1271
xlDialog(124, 1) = 322
xlDialog(125, 1) = 262
xlDialog(126, 1) = 834
xlDialog(127, 1) = 977
xlDialog(128, 1) = 119
xlDialog(129, 1) = 978
xlDialog(130, 1) = 667
xlDialog(131, 1) = 154
xlDialog(132, 1) = 207
xlDialog(133, 1) = 214
xlDialog(134, 1) = 1
xlDialog(135, 1) = 2
xlDialog(136, 1) = 188
xlDialog(137, 1) = 441
xlDialog(138, 1) = 318
xlDialog(139, 1) = 325
xlDialog(140, 1) = 319
xlDialog(141, 1) = 356
xlDialog(142, 1) = 458
xlDialog(143, 1) = 647
xlDialog(144, 1) = 355
xlDialog(145, 1) = 320
xlDialog(146, 1) = 142
xlDialog(147, 1) = 86
xlDialog(148, 1) = 186
xlDialog(149, 1) = 7
xlDialog(150, 1) = 91
xlDialog(151, 1) = 58
xlDialog(152, 1) = 53
xlDialog(153, 1) = 84
xlDialog(154, 1) = 832
xlDialog(155, 1) = 656
xlDialog(156, 1) = 570
xlDialog(157, 1) = 572
xlDialog(158, 1) = 689
xlDialog(159, 1) = 433
xlDialog(160, 1) = 313
xlDialog(161, 1) = 434
xlDialog(162, 1) = 421
xlDialog(163, 1) = 568
xlDialog(164, 1) = 567
xlDialog(165, 1) = 1183
xlDialog(166, 1) = 1153
xlDialog(167, 1) = 312
xlDialog(168, 1) = 300
xlDialog(169, 1) = 8
xlDialog(170, 1) = 9
xlDialog(171, 1) = 222
xlDialog(172, 1) = 202
xlDialog(173, 1) = 474
xlDialog(174, 1) = 754
xlDialog(175, 1) = 28
xlDialog(176, 1) = 620
xlDialog(177, 1) = 653
xlDialog(178, 1) = 445
xlDialog(179, 1) = 1258
xlDialog(180, 1) = 134
xlDialog(181, 1) = 127
xlDialog(182, 1) = 17
xlDialog(183, 1) = 5
xlDialog(184, 1) = 456
xlDialog(185, 1) = 208
xlDialog(186, 1) = 145
xlDialog(187, 1) = 285
xlDialog(188, 1) = 87
xlDialog(189, 1) = 307
xlDialog(190, 1) = 305
xlDialog(191, 1) = 308
xlDialog(192, 1) = 473
xlDialog(193, 1) = 311
xlDialog(194, 1) = 420
xlDialog(195, 1) = 731
xlDialog(196, 1) = 132
xlDialog(197, 1) = 189
xlDialog(198, 1) = 460
xlDialog(199, 1) = 557
xlDialog(200, 1) = 466
xlDialog(201, 1) = 504
xlDialog(202, 1) = 461
xlDialog(203, 1) = 462
xlDialog(204, 1) = 509
xlDialog(205, 1) = 1109
xlDialog(206, 1) = 1208
xlDialog(207, 1) = 23
xlDialog(208, 1) = 1108
xlDialog(209, 1) = 1107
xlDialog(210, 1) = 159
xlDialog(211, 1) = 204
xlDialog(212, 1) = 220
xlDialog(213, 1) = 261
xlDialog(214, 1) = 1182
xlDialog(215, 1) = 1184
xlDialog(216, 1) = 1179
xlDialog(217, 1) = 39
xlDialog(218, 1) = 192
xlDialog(219, 1) = 1134
xlDialog(220, 1) = 1133
xlDialog(221, 1) = 1135
xlDialog(222, 1) = 137
xlDialog(223, 1) = 190
xlDialog(224, 1) = 472
xlDialog(225, 1) = 44
xlDialog(226, 1) = 218
xlDialog(227, 1) = 398
xlDialog(228, 1) = 474
xlDialog(229, 1) = 41
xlDialog(230, 1) = 394
xlDialog(231, 1) = 422
xlDialog(232, 1) = 94
xlDialog(233, 1) = 201
xlDialog(234, 1) = 328
xlDialog(235, 1) = 478
xlDialog(236, 1) = 330
xlDialog(237, 1) = 197
xlDialog(238, 1) = 773
xlDialog(239, 1) = 686
xlDialog(240, 1) = 684
xlDialog(241, 1) = 687
xlDialog(242, 1) = 683
xlDialog(243, 1) = 685
xlDialog(244, 1) = 14
xlDialog(245, 1) = 13
xlDialog(246, 1) = 281
xlDialog(247, 1) = 283
xlDialog(248, 1) = 354
xlDialog(249, 1) = 282
xlDialog(250, 1) = 386
xlDialog(251, 1) = 302
xlDialog(252, 1) = 284
xlDialog(253, 1) = 417
xlDialog(254, 1) = 415
xlDialog(255, 1) = 384
xlDialog(256, 1) = 199
xlDialog(257, 1) = 95
xlDialog(258, 1) = 256
xlDialog(259, 1) = 1299
xlDialog(260, 1) = 496
xlDialog(261, 1) = 336
xlDialog(1, 2) = 'xlDialogActivate'
xlDialog(2, 2) = 'xlDialogActiveCellFont'
xlDialog(3, 2) = 'xlDialogAddChartAutoformat'
xlDialog(4, 2) = 'xlDialogAddinManager'
xlDialog(5, 2) = 'xlDialogAlignment'
xlDialog(6, 2) = 'xlDialogApplyNames'
xlDialog(7, 2) = 'xlDialogApplyStyle'
xlDialog(8, 2) = 'xlDialogAppMove'
xlDialog(9, 2) = 'xlDialogAppSize'
xlDialog(10, 2) = 'xlDialogArrangeAll'
xlDialog(11, 2) = 'xlDialogAssignToObject'
xlDialog(12, 2) = 'xlDialogAssignToTool'
xlDialog(13, 2) = 'xlDialogAttachText'
xlDialog(14, 2) = 'xlDialogAttachToolbars'
xlDialog(15, 2) = 'xlDialogAutoCorrect'
xlDialog(16, 2) = 'xlDialogAxes'
xlDialog(17, 2) = 'xlDialogBorder'
xlDialog(18, 2) = 'xlDialogCalculation'
xlDialog(19, 2) = 'xlDialogCellProtection'
xlDialog(20, 2) = 'xlDialogChangeLink'
xlDialog(21, 2) = 'xlDialogChartAddData'
xlDialog(22, 2) = 'xlDialogChartLocation'
xlDialog(23, 2) = 'xlDialogChartOptionsDataLabelMultiple'
xlDialog(24, 2) = 'xlDialogChartOptionsDataLabels'
xlDialog(25, 2) = 'xlDialogChartOptionsDataTable'
xlDialog(26, 2) = 'xlDialogChartSourceData'
xlDialog(27, 2) = 'xlDialogChartTrend'
xlDialog(28, 2) = 'xlDialogChartType'
xlDialog(29, 2) = 'xlDialogChartWizard'
xlDialog(30, 2) = 'xlDialogCheckboxProperties'
xlDialog(31, 2) = 'xlDialogClear'
xlDialog(32, 2) = 'xlDialogColorPalette'
xlDialog(33, 2) = 'xlDialogColumnWidth'
xlDialog(34, 2) = 'xlDialogCombination'
xlDialog(35, 2) = 'xlDialogConditionalFormatting'
xlDialog(36, 2) = 'xlDialogConsolidate'
xlDialog(37, 2) = 'xlDialogCopyChart'
xlDialog(38, 2) = 'xlDialogCopyPicture'
xlDialog(39, 2) = 'xlDialogCreateList'
xlDialog(40, 2) = 'xlDialogCreateNames'
xlDialog(41, 2) = 'xlDialogCreatePublisher'
xlDialog(42, 2) = 'xlDialogCreateRelationship'
xlDialog(43, 2) = 'xlDialogCustomizeToolbar'
xlDialog(44, 2) = 'xlDialogCustomViews'
xlDialog(45, 2) = 'xlDialogDataDelete'
xlDialog(46, 2) = 'xlDialogDataLabel'
xlDialog(47, 2) = 'xlDialogDataLabelMultiple'
xlDialog(48, 2) = 'xlDialogDataSeries'
xlDialog(49, 2) = 'xlDialogDataValidation'
xlDialog(50, 2) = 'xlDialogDefineName'
xlDialog(51, 2) = 'xlDialogDefineStyle'
xlDialog(52, 2) = 'xlDialogDeleteFormat'
xlDialog(53, 2) = 'xlDialogDeleteName'
xlDialog(54, 2) = 'xlDialogDemote'
xlDialog(55, 2) = 'xlDialogDisplay'
xlDialog(56, 2) = 'xlDialogDocumentInspector'
xlDialog(57, 2) = 'xlDialogEditboxProperties'
xlDialog(58, 2) = 'xlDialogEditColor'
xlDialog(59, 2) = 'xlDialogEditDelete'
xlDialog(60, 2) = 'xlDialogEditionOptions'
xlDialog(61, 2) = 'xlDialogEditSeries'
xlDialog(62, 2) = 'xlDialogErrorbarX'
xlDialog(63, 2) = 'xlDialogErrorbarY'
xlDialog(64, 2) = 'xlDialogErrorChecking'
xlDialog(65, 2) = 'xlDialogEvaluateFormula'
xlDialog(66, 2) = 'xlDialogExternalDataProperties'
xlDialog(67, 2) = 'xlDialogExtract'
xlDialog(68, 2) = 'xlDialogFileDelete'
xlDialog(69, 2) = 'xlDialogFileSharing'
xlDialog(70, 2) = 'xlDialogFillGroup'
xlDialog(71, 2) = 'xlDialogFillWorkgroup'
xlDialog(72, 2) = 'xlDialogFilter'
xlDialog(73, 2) ='xlDialogFilterAdvanced'
xlDialog(74, 2) = 'xlDialogFindFile'
xlDialog(75, 2) = 'xlDialogFont'
xlDialog(76, 2) = 'xlDialogFontProperties'
xlDialog(77, 2) = 'xlDialogFormatAuto'
xlDialog(78, 2) = 'xlDialogFormatChart'
xlDialog(79, 2) = 'xlDialogFormatCharttype'
xlDialog(80, 2) = 'xlDialogFormatFont'
xlDialog(81, 2) = 'xlDialogFormatLegend'
xlDialog(82, 2) = 'xlDialogFormatMain'
xlDialog(83, 2) = 'xlDialogFormatMove'
xlDialog(84, 2) = 'xlDialogFormatNumber'
xlDialog(85, 2) = 'xlDialogFormatOverlay'
xlDialog(86, 2) = 'xlDialogFormatSize'
xlDialog(87, 2) = 'xlDialogFormatText'
xlDialog(88, 2) = 'xlDialogFormulaFind'
xlDialog(89, 2) = 'xlDialogFormulaGoto'
xlDialog(90, 2) = 'xlDialogFormulaReplace'
xlDialog(91, 2) = 'xlDialogFunctionWizard'
xlDialog(92, 2) = 'xlDialogGallery3dArea'
xlDialog(93, 2) = 'xlDialogGallery3dBar'
xlDialog(94, 2) = 'xlDialogGallery3dColumn'
xlDialog(95, 2) = 'xlDialogGallery3dLine'
xlDialog(96, 2) = 'xlDialogGallery3dPie'
xlDialog(97, 2) = 'xlDialogGallery3dSurface'
xlDialog(98, 2) = 'xlDialogGalleryArea'
xlDialog(99, 2) = 'xlDialogGalleryBar'
xlDialog(100, 2) = 'xlDialogGalleryColumn'
xlDialog(101, 2) = 'xlDialogGalleryCustom'
xlDialog(102, 2) = 'xlDialogGalleryDoughnut'
xlDialog(103, 2) = 'xlDialogGalleryLine'
xlDialog(104, 2) = 'xlDialogGalleryPie'
xlDialog(105, 2) = 'xlDialogGalleryRadar'
xlDialog(106, 2) = 'xlDialogGalleryScatter'
xlDialog(107, 2) = 'xlDialogGoalSeek'
xlDialog(108, 2) = 'xlDialogGridlines'
xlDialog(109, 2) = 'xlDialogImportTextFile'
xlDialog(110, 2) = 'xlDialogInsert'
xlDialog(111, 2) = 'xlDialogInsertHyperlink'
xlDialog(112, 2) = 'xlDialogInsertObject'
xlDialog(113, 2) = 'xlDialogInsertPicture'
xlDialog(114, 2) = 'xlDialogInsertTitle'
xlDialog(115, 2) = 'xlDialogLabelProperties'
xlDialog(116, 2) = 'xlDialogListboxProperties'
xlDialog(117, 2) = 'xlDialogMacroOptions'
xlDialog(118, 2) = 'xlDialogMailEditMailer'
xlDialog(119, 2) = 'xlDialogMailLogon'
xlDialog(120, 2) = 'xlDialogMailNextLetter'
xlDialog(121, 2) = 'xlDialogMainChart'
xlDialog(122, 2) = 'xlDialogMainChartType'
xlDialog(123, 2) = 'xlDialogManageRelationships'
xlDialog(124, 2) = 'xlDialogMenuEditor'
xlDialog(125, 2) = 'xlDialogMove'
xlDialog(126, 2) = 'xlDialogMyPermission'
xlDialog(127, 2) = 'xlDialogNameManager'
xlDialog(128, 2) = 'xlDialogNew'
xlDialog(129, 2) = 'xlDialogNewName'
xlDialog(130, 2) = 'xlDialogNewWebQuery'
xlDialog(131, 2) = 'xlDialogNote'
xlDialog(132, 2) = 'xlDialogObjectProperties'
xlDialog(133, 2) = 'xlDialogObjectProtection'
xlDialog(134, 2) = 'xlDialogOpen'
xlDialog(135, 2) = 'xlDialogOpenLinks'
xlDialog(136, 2) = 'xlDialogOpenMail'
xlDialog(137, 2) = 'xlDialogOpenText'
xlDialog(138, 2) = 'xlDialogOptionsCalculation'
xlDialog(139, 2) = 'xlDialogOptionsChart'
xlDialog(140, 2) = 'xlDialogOptionsEdit'
xlDialog(141, 2) = 'xlDialogOptionsGeneral'
xlDialog(142, 2) = 'xlDialogOptionsListsAdd'
xlDialog(143, 2) = 'xlDialogOptionsME'
xlDialog(144, 2) = 'xlDialogOptionsTransition'
xlDialog(145, 2) = 'xlDialogOptionsView'
xlDialog(146, 2) = 'xlDialogOutline'
xlDialog(147, 2) = 'xlDialogOverlay'
xlDialog(148, 2) = 'xlDialogOverlayChartType'
xlDialog(149, 2) = 'xlDialogPageSetup'
xlDialog(150, 2) = 'xlDialogParse'
xlDialog(151, 2) = 'xlDialogPasteNames'
xlDialog(152, 2) = 'xlDialogPasteSpecial'
xlDialog(153, 2) = 'xlDialogPatterns'
xlDialog(154, 2) = 'xlDialogPermission'
xlDialog(155, 2) = 'xlDialogPhonetic'
xlDialog(156, 2) = 'xlDialogPivotCalculatedField'
xlDialog(157, 2) = 'xlDialogPivotCalculatedItem'
xlDialog(158, 2) = 'xlDialogPivotClientServerSet'
xlDialog(159, 2) = 'xlDialogPivotFieldGroup'
xlDialog(160, 2) = 'xlDialogPivotFieldProperties'
xlDialog(161, 2) = 'xlDialogPivotFieldUngroup'
xlDialog(162, 2) = 'xlDialogPivotShowPages'
xlDialog(163, 2) = 'xlDialogPivotSolveOrder'
xlDialog(164, 2) = 'xlDialogPivotTableOptions'
xlDialog(165, 2) = 'xlDialogPivotTableSlicerConnections'
xlDialog(166, 2) = 'xlDialogPivotTableWhatIfAnalysisSettings'
xlDialog(167, 2) = 'xlDialogPivotTableWizard'
xlDialog(168, 2) = 'xlDialogPlacement'
xlDialog(169, 2) = 'xlDialogPrint'
xlDialog(170, 2) = 'xlDialogPrinterSetup'
xlDialog(171, 2) = 'xlDialogPrintPreview'
xlDialog(172, 2) = 'xlDialogPromote'
xlDialog(173, 2) = 'xlDialogProperties'
xlDialog(174, 2) = 'xlDialogPropertyFields'
xlDialog(175, 2) = 'xlDialogProtectDocument'
xlDialog(176, 2) = 'xlDialogProtectSharing'
xlDialog(177, 2) = 'xlDialogPublishAsWebPage'
xlDialog(178, 2) = 'xlDialogPushbuttonProperties'
xlDialog(179, 2) = 'xlDialogRecommendedPivotTables'
xlDialog(180, 2) = 'xlDialogReplaceFont'
xlDialog(181, 2) = 'xlDialogRowHeight'
xlDialog(182, 2) = 'xlDialogRun'
xlDialog(183, 2) = 'xlDialogSaveAs'
xlDialog(184, 2) = 'xlDialogSaveCopyAs'
xlDialog(185, 2) = 'xlDialogSaveNewObject'
xlDialog(186, 2) = 'xlDialogSaveWorkbook'
xlDialog(187, 2) = 'xlDialogSaveWorkspace'
xlDialog(188, 2) = 'xlDialogScale'
xlDialog(189, 2) = 'xlDialogScenarioAdd'
xlDialog(190, 2) = 'xlDialogScenarioCells'
xlDialog(191, 2) = 'xlDialogScenarioEdit'
xlDialog(192, 2) = 'xlDialogScenarioMerge'
xlDialog(193, 2) = 'xlDialogScenarioSummary'
xlDialog(194, 2) = 'xlDialogScrollbarProperties'
xlDialog(195, 2) = 'xlDialogSearch'
xlDialog(196, 2) = 'xlDialogSelectSpecial'
xlDialog(197, 2) = 'xlDialogSendMail'
xlDialog(198, 2) = 'xlDialogSeriesAxes'
xlDialog(199, 2) = 'xlDialogSeriesOptions'
xlDialog(200, 2) = 'xlDialogSeriesOrder'
xlDialog(201, 2) = 'xlDialogSeriesShape'
xlDialog(202, 2) = 'xlDialogSeriesX'
xlDialog(203, 2) = 'xlDialogSeriesY'
xlDialog(204, 2) = 'xlDialogSetBackgroundPicture'
xlDialog(205, 2) = 'xlDialogSetManager'
xlDialog(206, 2) = 'xlDialogSetMDXEditor'
xlDialog(207, 2) = 'xlDialogSetPrintTitles'
xlDialog(208, 2) = 'xlDialogSetTupleEditorOnColumns'
xlDialog(209, 2) = 'xlDialogSetTupleEditorOnRows'
xlDialog(210, 2) = 'xlDialogSetUpdateStatus'
xlDialog(211, 2) = 'xlDialogShowDetail'
xlDialog(212, 2) = 'xlDialogShowToolbar'
xlDialog(213, 2) = 'xlDialogSize'
xlDialog(214, 2) = 'xlDialogSlicerCreation'
xlDialog(215, 2) = 'xlDialogSlicerPivotTableConnections'
xlDialog(216, 2) = 'xlDialogSlicerSettings'
xlDialog(217, 2) = 'xlDialogSort'
xlDialog(218, 2) = 'xlDialogSortSpecial'
xlDialog(219, 2) = 'xlDialogSparklineInsertColumn'
xlDialog(220, 2) = 'xlDialogSparklineInsertLine'
xlDialog(221, 2) = 'xlDialogSparklineInsertWinLoss'
xlDialog(222, 2) = 'xlDialogSplit'
xlDialog(223, 2) = 'xlDialogStandardFont'
xlDialog(224, 2) = 'xlDialogStandardWidth'
xlDialog(225, 2) ='xlDialogStyle'
xlDialog(226, 2) = 'xlDialogSubscribeTo'
xlDialog(227, 2) = 'xlDialogSubtotalCreate'
xlDialog(228, 2) = 'xlDialogSummaryInfo'
xlDialog(229, 2) = 'xlDialogTable'
xlDialog(230, 2) = 'xlDialogTabOrder'
xlDialog(231, 2) = 'xlDialogTextToColumns'
xlDialog(232, 2) = 'xlDialogUnhide'
xlDialog(233, 2) = 'xlDialogUpdateLink'
xlDialog(234, 2) = 'xlDialogVbaInsertFile'
xlDialog(235, 2) = 'xlDialogVbaMakeAddin'
xlDialog(236, 2) = 'xlDialogVbaProcedureDefinition'
xlDialog(237, 2) = 'xlDialogView3d'
xlDialog(238, 2) = 'xlDialogWebOptionsBrowsers'
xlDialog(239, 2) = 'xlDialogWebOptionsEncoding'
xlDialog(240, 2) = 'xlDialogWebOptionsFiles'
xlDialog(241, 2) = 'xlDialogWebOptionsFonts'
xlDialog(242, 2) = 'xlDialogWebOptionsGeneral'
xlDialog(243, 2) = 'xlDialogWebOptionsPictures'
xlDialog(244, 2) = 'xlDialogWindowMove'
xlDialog(245, 2) = 'xlDialogWindowSize'
xlDialog(246, 2) = 'xlDialogWorkbookAdd'
xlDialog(247, 2) = 'xlDialogWorkbookCopy'
xlDialog(248, 2) = 'xlDialogWorkbookInsert'
xlDialog(249, 2) = 'xlDialogWorkbookMove'
xlDialog(250, 2) = 'xlDialogWorkbookName'
xlDialog(251, 2) = 'xlDialogWorkbookNew'
xlDialog(252, 2) ='xlDialogWorkbookOptions'
xlDialog(253, 2) = 'xlDialogWorkbookProtect'
xlDialog(254, 2) = 'xlDialogWorkbookTabSplit'
xlDialog(255, 2) = 'xlDialogWorkbookUnhide'
xlDialog(256, 2) = 'xlDialogWorkgroup'
xlDialog(257, 2) = 'xlDialogWorkspace'
xlDialog(258, 2) = 'xlDialogZoom'
xlDialog(259, 1) = 'xlDialogForecastETS'
xlDialog(260, 1) = 'xlDialogInsertNameLabel'
xlDialog(261, 1) = 'xlDialogRoutingSlip'
With ActiveCell
.Offset(0, 0) = 'Value'
.Offset(0, 0).HorizontalAlignment =xlRight
.Offset(0, 1) = 'Name'
.Offset(i, 1).IndentLevel = 1
For i = LBound(xlDialog) ToUBound(xlDialog)
.Offset(i, 0).Value = xlDialog(i,1)
.Offset(i, 1).Value = xlDialog(i,2)
.Offset(i, 1).IndentLevel = 1
Next i
End With
End Sub
在Office開發中心網站上提供了内置對話框參數列表。下面演示xlDialogWorkspace(“工作區選項”)對話框的16個參數,代碼如下。
Sub xlDialogWspace() '' Arg1: 自動小數點;Arg2: 位數;Arg3: R1C1; '' Arg4: 滾動條;Arg5: 狀态欄;Arg6: 編輯欄; '' Arg7: 菜單鍵;Arg8: 遠程;Arg9 :按Enter移動; '' Arg10:下劃線;Arg11: 工具;Arg12: 批注; '' Arg13:導航鍵;Arg14: 菜單鍵操作;Arg15: 拖放; '' Arg16:顯示信息 '' 設置Wspace- 通過參數名 Application.Dialogs(xlDialogWorkspace).Show Arg3:=True, Arg4:=False,Arg5:=False, Arg6:=False '' 重設Wspace- 通過位置 Application.Dialogs(xlDialogWorkspace).Show , , False, True, True, TrueEnd Sub
按參數名設置該對話框的效果如下圖4所示。 圖4 按位置設置該對話框的效果如下圖5所示,此時忽略的參數要使用逗号。 圖5 有興趣的朋友可以進一步研究。
歡迎在下面留言,完善本文内容,讓更多的人學到更完美的知識。
歡迎到知識星球:完美Excel社群,進行技術交流和提問,獲取更多電子資料,并通過社群加入專門的微信讨論群,更方便交流。
|
有話要說...