是這樣的,我有一個程序:
當我寫成:
var oRng=oSheet.Range("A2:E10");
oRng.EntireColumn.AutoFit();
oRng.Borders.LineStyle = xlDouble;
oRng.Borders.Weight = xlThin;
時無法運行,改成
var oRng=oSheet.Range("A2:E10"));
oRng.EntireColumn.AutoFit();
oRng.Borders.LineStyle = -4119;
oRng.Borders.Weight = 2;
後行正常,也就是說當我使用常量時,程序認不到,隻有寫成該常量的值後,程序才可運行。請問是什麼原因?另外有誰能給出下列常量對應的值:
xlContinuous, xlDash, xlDashDot, xlDashDotDot, xlDot, xlDouble, xlSlantDashDot, xlLineStyleNone,  
xlHairline, xlThin, xlMedium, xlThick,  
xlDiagonalDown, xlDiagonalUp, xlEdgeBottom, xlEdgeLeft, xlEdgeRight, xlEdgeTop, xlInsideHorizontal,xlInsideVertical

解决方案 »

  1.   

    up....没用过。建议去  开发语言的Office开发/VBA问一下
    gz
      

  2.   

    希望能有结果,,如果可以的话。把结果发我一份。[email protected]
      

  3.   


     这些常量的值在excel的VBA中是可以直接使用的,在vb中必须自己设定。 xl24HourClock 33
    xl3DArea -4098
    xl3DBar -4099
    xl3DColumn -4100
    xl3DEffects1 13
    xl3DEffects2 14
    xl3DLine -4101
    xl3DPie -4102
    xl3DSurface -4103
    xl4DigitYears 43
    xlA1 1
    xlAbove 0
    xlAbsolute 1
    xlAbsRowRelColumn 2
    xlAccounting1 4
    xlAccounting2 5
    xlAccounting3 6
    xlAccounting4 17
    xlAdd 2
    xlAddIn 18
    xlAll -4104
    xlAllAtOnce 2
    xlAlternateArraySeparator 16
    xlAnd 1
    xlArea 1
    xlAscending 1
    xlAutoActivate 3
    xlAutoClose 2
    xlAutoDeactivate 4
    xlAutoFill 4
    xlAutomatic -4105
    xlAutomaticUpdate 4
    xlAutoOpen 1
    xlAverage -4106
    xlAxis 21
    xlBar 2
    xlBelow 1
    xlBIFF 2
    xlBitmap 2
    xlBlanks 4
    xlBMP 1
    xlBoth 1
    xlBottom -4107
    xlBuiltIn 0
    xlButton 15
    xlByColumns 2
    xlByRows 1
    xlCancel 1
    xlCap 1
    xlCascade 7
    xlCategory 1
    xlCenter -4108
    xlCenterAcrossSelection 7

    xlCGM 7
    xlChangeAttributes 6
    xlChart -4109
    xlChart4 2


    xlChartAsWindow 5
    xlChartInPlace 4
    xlChartSeries 17
    xlChartShort 6


    xlChartTitles 18
    xlChecker 9

    xlChronological 3
    xlCircle 8

    xlClassic1 1
    xlClassic2 2
    xlClassic3 3
    xlClipboard 3
    xlClipboardFormatBIFF 8
    xlClipboardFormatBIFF2 18
    xlClipboardFormatBIFF3 20
    xlClipboardFormatBIFF4 30
    xlClipboardFormatBinary 15
    xlClipboardFormatBitmap 9
    xlClipboardFormatCGM 13
    xlClipboardFormatCSV 5
    xlClipboardFormatDIF 4
    xlClipboardFormatDspText 12
    xlClipboardFormatEmbeddedObjec Application::ClipboardFormats
    xlClipboardFormatEmbedSource 22
    xlClipboardFormatLink 11
    xlClipboardFormatLinkSource 23
    xlClipboardFormatLinkSourceDes Application::ClipboardFormats
    xlClipboardFormatMovie 24
    xlClipboardFormatNative 14
    xlClipboardFormatObjectDesc 31
    xlClipboardFormatObjectLink 19
    xlClipboardFormatOwnerLink 17
    xlClipboardFormatPICT 2
    xlClipboardFormatPrintPICT 3
    xlClipboardFormatRTF 7
    xlClipboardFormatScreenPICT 29
    xlClipboardFormatStandardFont 28
    xlClipboardFormatStandardScale Application::ClipboardFormats
    xlClipboardFormatSYLK 6
    xlClipboardFormatTable 16
    xlClipboardFormatText 0
    xlClipboardFormatToolFace 25
    xlClipboardFormatToolFacePICT 26
    xlClipboardFormatVALU 1
    xlClipboardFormatWK1 10
    xlClosed 3
    xlCodePage 2
    xlColor1 7
    xlColor2 8
    xlColor3 9
    xlColumn 3




    xlColumnField 2
    xlColumnHeader -4110

    xlColumnItem 5
    xlColumns 2




    xlColumnSeparator 14
    xlColumnThenRow 2
    xlCombination -4111

    xlCommand 2
    xlConsolidation 3
    xlConstants 2
    xlContents 2
    xlContinuous 1



    xlCopy 1
    xlCorner 2
    xlCount -4112
    xlCountNums -4113
    xlCountryCode 1
    xlCountrySetting 2
    xlCrissCross 16

    xlCross 4

    xlCSV 6
    xlCSVMac 22


    xlCSVMSDOS 24


    xlCSVWindows 23


    xlCurrencyBefore 37
    xlCurrencyCode 25
    xlCurrencyDigits 27
    xlCurrencyLeadingZeros 40
    xlCurrencyMinusSign 38
    xlCurrencyNegative 28
    xlCurrencySpaceBefore 36
    xlCurrencyTrailingZeros 39
    xlCustom -4114


    xlCut 2
    xlDash -4115
    xlDashDot 4


    xlDashDotDot 5


    xlDatabase 1
    xlDataField 4
    xlDataHeader 3
    xlDataItem 7
    xlDate 2
    xlDateOrder 32
    xlDateSeparator 17
    xlDay 1
    xlDayCode 21
    xlDayLeadingZero 42
    xlDBF2 7


    xlDBF3 8


    xlDBF4 11


    xlDebugCodePane 13
    xlDecimalSeparator 3
    xlDefaultAutoFormat -1
    xlDelimited 1

    xlDescending 2

    xlDesktop 9
    xlDialogActivate 103
    xlDialogActiveCellFont 476
    xlDialogAddChartAutoformat 390
    xlDialogAddinManager 321
    xlDialogAlignment 43
    xlDialogApplyNames 133
    xlDialogApplyStyle 212
    xlDialogAppMove 170
    xlDialogAppSize 171
    xlDialogArrangeAll 12
    xlDialogAssignToObject 213
    xlDialogAssignToTool 293
    xlDialogAttachText 80
    xlDialogAttachToolbars 323
    xlDialogAttributes 219
    xlDialogAxes 78
    xlDialogBorder 45
    xlDialogCalculation 32
    xlDialogCellProtection 46
    xlDialogChangeLink 166
    xlDialogChartAddData 392
    xlDialogChartTrend 350
    xlDialogChartWizard 288
    xlDialogCheckboxProperties 435
    xlDialogClear 52
    xlDialogColorPalette 161
    xlDialogColumnWidth 47
    xlDialogCombination 73
    xlDialogConsolidate 191
    xlDialogCopyChart 147
    xlDialogCopyPicture 108
    xlDialogCreateNames 62
    xlDialogCreatePublisher 217
    xlDialogCustomizeToolbar 276
    xlDialogDataDelete 36
    xlDialogDataLabel 379
    xlDialogDataSeries 40
    xlDialogDefineName 61
    xlDialogDefineStyle 229
    xlDialogDeleteFormat 111
    xlDialogDeleteName 110
    xlDialogDemote 203
    xlDialogDisplay 27
    xlDialogEditboxProperties 438
    xlDialogEditColor 223
    xlDialogEditDelete 54
    xlDialogEditionOptions 251
    xlDialogEditSeries 228
    xlDialogErrorbarX 463
    xlDialogErrorbarY 464
    xlDialogExtract 35
    xlDialogFileDelete 6
    xlDialogFillGroup 200
    xlDialogFillWorkgroup 301
    xlDialogFilterAdvanced 370
    xlDialogFindFile 475
    xlDialogFont 26
    xlDialogFontProperties 381
    xlDialogFormatAuto 269
    xlDialogFormatChart 465
    xlDialogFormatCharttype 423
    xlDialogFormatFont 150
    xlDialogFormatLegend 88
    xlDialogFormatMain 225
    xlDialogFormatMove 128
    xlDialogFormatNumber 42
    xlDialogFormatOverlay 226
    xlDialogFormatSize 129
    xlDialogFormatText 89
    xlDialogFormulaFind 64
    xlDialogFormulaGoto 63
    xlDialogFormulaReplace 130
    xlDialogFunctionWizard 450
    xlDialogGallery3dArea 193
    xlDialogGallery3dBar 272
    xlDialogGallery3dColumn 194
    xlDialogGallery3dLine 195
    xlDialogGallery3dPie 196
    xlDialogGallery3dSurface 273
    xlDialogGalleryArea 67
    xlDialogGalleryBar 68
    xlDialogGalleryColumn 69
    xlDialogGalleryCustom 388
    xlDialogGalleryDoughnut 344
    xlDialogGalleryLine 70
    xlDialogGalleryPie 71
    xlDialogGalleryRadar 249
    xlDialogGalleryScatter 72
    xlDialogGoalSeek 198
    xlDialogGridlines 76
    xlDialogInsert 55
    xlDialogInsertObject 259
    xlDialogInsertPicture 342
    xlDialogInsertTitle 380
    xlDialogLabelProperties 436
    xlDialogListboxProperties 437
      

  4.   

    xlUpward -4171
    xlDownward -4170
    xlXYScatter -4169
    xlX -4168
    xlWorksheet -4167
    xlVertical -4166
    xlVarP -4165
    xlVar -4164
    xlValues -4163
    xlUp -4162
    xlToRight -4161
    xlTop -4160
    xlToLeft -4159
    xlText -4158
    xlSum -4157
    xlStDevP -4156
    xlStDev -4155
    xlSimple -4154
    xlRowHeader -4153
    xlRight -4152
    xlRadar -4151
    xlR1C1 -4150
    xlProduct -4149
    xlPivotTable -4148
    xlPicture -4147
    xlOff -4146
    xlNumber -4145
    xlNotes -4144
    xlNormal -4143
    xlNone -4142
    xlModule -4141
    xlMinimized -4140
    xlMin -4139
    xlMedium -4138
    xlMaximized -4137
    xlMax -4136
    xlManual -4135
    xlLow -4134
    xlLogarithmic -4133
    xlLinear -4132
    xlLeft -4131
    xlJustify -4130
    xlInfo -4129
    xlHorizontal -4128
    xlHigh -4127
    xlGray75 -4126
    xlGray50 -4125
    xlGray25 -4124
    xlFormulas -4123
    xlFormats -4122
    xlDown -4121
    xlDoughnut -4120
    xlDouble -4119
    xlDot -4118
    xlDistributed -4117
    xlDialogSheet -4116
    xlDisabled 0
    xlFillDefault 0
    xlFirst 0
    xlGuess 0
    xlHidden 0
    xlNoMailSystem 0
    xlNotYetRouted 0
    xlOLELink 0
    xlDialogOpen 1
    xlDirect 1
    xlDoubleQuote 1
    xlDownThenOver 1
    xlExcelLinks 1
    xlExcelMenus 1
    xlFillCopy 1
    xlFilterInPlace 1
    xlFixedValue 1
    xlFunction 1
    xlGeneral 1
    xlHairline 1
    xlIcons 1
    xlInterrupt 1
    xlLast 1
    xlMacintosh 1
    xlMAPI 1
    xlMicrosoftWord 1
    xlMoveAndSize 1
    xlNarrow 1
    xlNext 1
    xlNotPlotted 1
    xlNumbers 1
    xlOLEEmbed 1
    xlOn 1
    xlOneAfterAnother 1
    xlPaperLetter 1
    xlPICT 1
    xlPortrait 1
    xlPrimary 1
    xlPublisher 1
    xlRoutingInProgress 1
    xlRowField 1
    xlRows 1
    xlRowThenColumn 1
    xlScreen 1
    xlScreenSize 1
    xlShort 1
    xlSolid 1
    xlSortValues 1
    xlSquare 1
    xlStandardSummary 1
    xlStretch 1
    xlSyllabary 1
    xlTiled 1
    xlToolbar 1
    xlTopToBottom 1
    xlUpdateState 1
    xlWhole 1
    xlWorkbook 1
    xlWorksheet4 1
    xlY 1
    xlYes 1
    xlDialogOpenLinks 2
    xlDiamond 2
    xlDifferenceFrom 2
    xlEditionDate 2
    xlErrorHandler 2
    xlExtended 2
    xlExternal 2
    xlFillSeries 2
    xlFilterCopy 2
    xlFitToPage 2
    xlFixedWidth 2
    xlGrowth 2
    xlInside 2
    xlInteger 2
    xlLandscape 2
    xlLeftToRight 2
    xlLotusHelp 2
    xlMaximum 2
    xlMicrosoftPowerPoint 2
    xlMinimum 2
    xlMixed 2
    xlMove 2
    xlNo 2
    xlNoCap 2
    xlOLELinks 2
    xlOpen 2
    xlOr 2
    xlOverThenDown 2
    xlPageHeader 2
    xlPaperLetterSmall 2
    2
    xlPercent 2
    xlPlaceholders 2
    xlPlusValues 2
    xlPrevious 2
    2
    xlPrinter 2
    xlReadWrite 2
    xlRoutingComplete 2
    xlSecondary 2
    xlSemiautomatic 2
    xlSendPublisher 2
    xlShowValue 2
    xlSingle 2
    xlSingleQuote 2
    xlSortLabels 2
    xlStack 2
    xlStrict 2
    xlSubscriber 2
    xlSYLK 2
    xlTextValues 2
    xlThin 2
    xlToolbarButton 2
    xlTransparent 2
    xlUpdateSubscriber 2
    xlValue 2
    xlVeryHidden 2
    xlWeekday 2
    xlWindows 2
    xlWMF 2
    xlZero 2
    xlExcel4MacroSheet 3
    xlFillFormats 3
    xlFreeFloating 3
    xlFullPage 3
    xlHide 3
    xlInterpolated 3
    xlLong 3
    xlMicrosoftMail 3
    xlMinusValues 3
    xlMonth 3
    xlMSDOS 3
    xlNoDocuments 3
    xlOpaque 3
    xlOpenSource 3
    xlOutside 3
    xlPageField 3
    xlPaperTabloid 3
    xlPercentOf 3
    xlPolynomial 3
    xlReadOnly 3
    xlRelRowAbsColumn 3
    xlScale 3
    xlSelect 3
    xlSeries 3
    xlShowPercent 3
    xlSubtract 3
    xlTriangle 3
    xlWide 3
    xlWorksheetCell 3
    xlWPG 3
    xlDoubleOpen 4
    xlDRW 4
    xlExcel4IntlMacroSheet 4
    xlFillValues 4
    xlLine 4
    xlLogical 4
    xlMicrosoftAccess 4
    xlMultiply 4
    xlNextToAxis 4
    xlPaperLedger 4
    xlPercentDifferenceFrom 4
    xlPower 4
    xlReference 4
    xlRelative 4
    xlRowItem 4
    xlRTF 4
    xlShowLabel 4
    xlSingleAccounting 4
    xlStError 4
    xlThick 4
    xlThousandsSeparator 4
    xlWKS 4
    xlYear 4
    xlDialogSaveAs 5
    xlDivide 5
    xlDoubleAccounting 5
    xlDoubleClosed 5
    xlDXF 5
    xlExponential 5
    xlFill 5
    xlFillDays 5
    xlFloating 5
    xlFormula 5
    xlListSeparator 5
    xlManualUpdate 5
    xlMicrosoftFoxPro 5
    xlPaperLegal 5
    xlPie 5
    xlPublishers 5
    xlRunningTotal 5
    xlShowLabelAndPercent 5
    xlStar 5
    xlWK1 5
    xlWorksheetShort 5
      

  5.   

    xlFillWeekdays 6
    xlHGL 6
    xlMicrosoftProject 6
    xlMovingAvg 6
    xlPageItem 6
    xlPaperStatement 6
    xlPercentOfRow 6
    xlSubscribers 6
    xlUpperCaseRowLetter 6
    xlWorkbookTab 6
    xlDialogPageSetup 7
    xlFillMonths 7
    xlMacrosheetCell 7
    xlMicrosoftSchedulePlus 7
    xlPaperExecutive 7
    xlPercentOfColumn 7
    xlUpperCaseColumnLetter 7
    xlDialogPrint 8
    xlEPS 8
    xlFillYears 8
    xlLowerCaseRowLetter 8
    xlPaperA3 8
    xlPercentOfTotal 8
    xlTableBody 8
    xlTitleBar 8
    xlVALU 8
    xlDialogPrinterSetup 9
    xlDIF 9
    xlIndex 9
    xlLinearTrend 9
    xlLowerCaseColumnLetter 9
    xlPaperA4 9
    xlPlus 9
    xlTIF 9
    xlGrowthTrend 10
    xlLeftBracket 10
    xlList1 10
    xlPaperA4Small 10
    xlPCX 10
    xlSemiGray75 10
    xlLastCell 11
    xlLightHorizontal 11
    xlList2 11
    xlPaperA5 11
    xlPIC 11
    xlRightBracket 11
    xlWatchPane 11
    xlImmediatePane 12
    xlLeftBrace 12
    xlLightVertical 12
    xlList3 12
    xlPaperB4 12
    xlPLT 12
    xlVisible 12
    xlDialogWindowSize 13
    xlLightDown 13
    xlPaperB5 13
    xlPCT 13
    xlRightBrace 13
    xlDialogWindowMove 14
    xlDrawingObject 14
    xlLightUp 14
    xlPaperFolio 14
    xlWJ2WD1 14
    xlGrid 15
    xlLocalFormat1 15
    xlPaperQuarto 15
    xlRowSeparator 15
    xlWK3 15
    xlErrors 16
    xlExcel2 16
    xlLocalFormat2 16
    xlPaper10x14 16
    xlTextBox 16
    xlDialogRun 17
    xlGray16 17
    xlPaper11x17 17
    xlTemplate 17
    xlGray8 18
    xlPaperNote 18
    xlTimeSeparator 18
    xlPaperEnvelope9 19
    xlPlotArea 19
    xlTextMac 19
    xlYearCode 19
    xlEntireChart 20
    xlMonthCode 20
    xlPaperEnvelope10 20
    xlTextWindows 20
    xlPaperEnvelope11 21
    xlTextMSDOS 21
    xlGridline 22
    xlHourCode 22
    xlPaperEnvelope12 22
    xlDialogSetPrintTitles 23
    xlFloor 23
    xlMinuteCode 23
    xlPaperEnvelope14 23
    xlLegend 24
    xlPaperCsheet 24
    xlSecondCode 24
    xlIntlMacro 25
    xlPaperDsheet 25
    xlGeneralFormatName 26
    xlIntlAddIn 26
    xlPaperEsheet 26
    xlExcel2FarEast 27
    xlPaperEnvelopeDL 27
    xlDialogProtectDocument 28
    xlPaperEnvelopeC5 28
    xlWorks2FarEast 28
    xlExcel3 29
    xlNoncurrencyDigits 29
    xlPaperEnvelopeC3 29
    xlMonthNameChars 30
    xlPaperEnvelopeC4 30
    xlWK1FMT 30
    xlPaperEnvelopeC6 31
    xlWeekdayNameChars 31
    xlWK1ALL 31
    xlPaperEnvelopeC65 32
    xlWK3FM3 32
    xlExcel4 33
    xlPaperEnvelopeB4 33
    xlNonEnglishFunctions 34
    xlPaperEnvelopeB5 34
    xlWQ1 34
    xlExcel4Workbook 35
    xlMetric 35
    xlPaperEnvelopeB6 35
    xlPaperEnvelopeItaly 36
    xlTextPrinter 36
    xlPaperEnvelopeMonarch 37
    xlPaperEnvelopePersonal 38
    xlDialogSort 39
    xlPaperFanfoldUS 39
    xlPaperFanfoldStdGerman 40
    xlDialogTable 41
    xlMonthLeadingZero 41
    xlPaperFanfoldLegalGerman 41
    xlDialogStyle 44
    xlMDY 44
    xlTimeLeadingZero 45
    xlDialogPasteSpecial 53
    xlDialogPatterns 84
    xlDialogMainChart 85
    xlDialogOverlay 86
    xlDialogScale 87
    xlDialogParse 91
    xlDialogUnhide 94
    xlDialogWorkspace 95
    xlDialogNew 119
    xlDialogRowHeight 127
    xlDialogSelectSpecial 132
    xlDialogReplaceFont 134
    xlDialogSplit 137
    xlDialogOutline 142
    xlDialogSaveWorkbook 145
    xlDialogNote 154
    xlDialogSetUpdateStatus 159
    xlDialogMainChartType 185
    xlDialogOverlayChartType 186
    xlDialogOpenMail 188
    xlDialogSendMail 189
    xlDialogStandardFont 190
    xlDialogSortSpecial 192
    xlDialogView3d 197
    xlDialogWorkgroup 199
    xlDialogUpdateLink 201
    xlDialogPromote 202
    xlDialogShowDetail 204
    xlDialogObjectProperties 207
    xlDialogSaveNewObject 208
    xlDialogObjectProtection 214
    xlDialogSubscribeTo 218
    xlDialogShowToolbar 220
    xlDialogPrintPreview 222
    xlDialogZoom 256
    xlPaperUser 256
    xlDialogSize 261
    xlDialogMove 262
    xlDialogWorkbookAdd 281
    xlDialogWorkbookMove 282
    xlDialogWorkbookCopy 283
    xlDialogWorkbookOptions 284
    xlDialogSaveWorkspace 285
    xlDialogPlacement 300
    xlDialogWorkbookNew 302
    xlDialogScenarioCells 305
    xlDialogScenarioAdd 307
    xlDialogScenarioEdit 308
    xlDialogScenarioSummary 311
    xlDialogPivotTableWizard 312
    xlDialogPivotFieldProperties 313
    xlDialogOptionsCalculation 318
    xlDialogOptionsEdit 319
    xlDialogOptionsView 320
    xlDialogMenuEditor 322
    xlDialogOptionsChart 325
    xlDialogVbaInsertFile 328
    xlDialogRoutingSlip 336
    xlDialogMailLogon 339
    xlDialogWorkbookInsert 354
    xlDialogOptionsTransition 355
    xlDialogOptionsGeneral 356
    xlDialogMailNextLetter 378
    xlDialogMacroOptions 382
    xlDialogWorkbookUnhide 384
    xlDialogWorkbookName 386
    xlDialogTabOrder 394
    xlDialogSubtotalCreate 398
    xlDialogWorkbookTabSplit 415
    xlDialogWorkbookProtect 417
    xlDialogScrollbarProperties 420
    xlDialogPivotShowPages 421
    xlDialogTextToColumns 422
    xlDialogPivotFieldGroup 433
    xlDialogPivotFieldUngroup 434
    xlDialogOpenText 441
    xlDialogPushbuttonProperties 445
    xlDialogSetControlValue 455
    xlDialogSaveCopyAs 456
    xlDialogOptionsListsAdd 458
    xlDialogSeriesAxes 460
    xlDialogSeriesX 461
    xlDialogSeriesY 462
    xlDialogSeriesOrder 466
    xlDialogStandardWidth 472
    xlDialogScenarioMerge 473
    xlDialogSummaryInfo 474
    xlDialogVbaMakeAddin 478
    xlErrNull 2000
    xlErrDiv0 2007
    xlErrValue 2015
    xlErrRef 2023
    xlErrName 2029
    xlErrNum 2036
    xlErrNA 2042