首页 vba的对象属性大全

vba的对象属性大全

举报
开通vip

vba的对象属性大全第1章Application对象当前操作系统的名称和版本号Application.OperatingSystem当前的注册组织名Application.OrganizationName计算机名Environ("computername")当前用户名Application.UserNameEnviron("Username")启动微软的应用程序Application.ActivateMicrosoftAppxx为:xlMicrosoftWordxlMicrosoftPowerPointxlMicrosoftMailx...

vba的对象属性大全
第1章Application对象当前操作系统的名称和版本号Application.OperatingSystem当前的注册组织名Application.OrganizationName计算机名Environ("computername")当前用户名Application.UserNameEnviron("Username")启动微软的应用程序Application.ActivateMicrosoftAppxx为:xlMicrosoftWordxlMicrosoftPowerPointxlMicrosoftMailxlMicrosoftAccessxlMicrosoftFoxProxlMicrosoftProjectxlMicrosoftSchedulePlus当前剩余内存Application.MemoryFree当前MicrosoftExcel的总内存Application.MemoryTotal被Excel使用的内存Application.MemoryUsedExcel版本Application.VersionExcel安装路径Application.Path启动Excel的路径Application.StartupPath打开Excel文件时使用的默认路径Application.DefaultFilePath模板保存的默认路径Application.TemplatesPath库文件夹的路径Application.LibraryPath路径分隔符Application.PathSeparator设置文件 清单 安全隐患排查清单下载最新工程量清单计量规则下载程序清单下载家私清单下载送货清单下载 中的最多文件数Application.RecentFiles.Maximum=n设置新工作簿中的工作表个数Application.SheetsInNewWorkbook=n设置文件的默认位置Application.DefaultFilePath="路径"打开Excel帮助文件Application.HelpExcel全屏显示Application.DisplayFullScreen=TrueApplication.DisplayFullScreen=FalseExcel窗口显示Application.WindowState=xx为:xlMaximizedxlMinimizedxlNormalExcel窗口位置Application.HeightApplication.WidthApplication.LeftApplication.Top在主窗口中所能占有的最大高度和宽度Application.UsableHeightApplication.UsableWidth隐藏显示ExcelApplication.Visible=False\TrueExcel标题设置Application.Caption="***"修改标题Application.Caption=vbNullString恢复默认Application.Caption=vbNullChar删除标题设置状态栏中的文字Application.StatusBar="***"Application.StatusBar=False隐藏显示状态栏Application.DisplayStatusBar=False\True隐藏显示编辑栏Application.DisplayFormulaBar=False\True隐藏显示常用工具栏Application.CommandBars("Standard").Visible=False\True隐藏显示格式工具栏Application.CommandBars("Formatting").Visible=False\True隐藏显示任务窗格Application.CommandBars("TaskPane").Visible=False\True更改鼠标指针形状Application.Cursor=xx为:xlWait沙漏型指针xlIBeamI型指针xlNorthwestArrow西北向箭头指针xlDefault恢复默认撤消上次操作Application.Undo自动手动计算Application.Calculation=xx为:xlCalculationAutomatic自动计算xlCalculationManual手动计算xlCalculationSemiautomatic除模拟运算表外,自动计算切换引用样式Application.ReferenceStyle=xlA1A1引用样式Application.ReferenceStyle=xlR1C1R1C1引用样式按回车切换单元格移动方向Application.MoveAfterReturn=True按下Enter活动单元格的位置可以改变Application.MoveAfterReturnDirection=xx为:向右移动xlToRight向下移动xlDown向左移动xlToLeft向上移动xlUp禁用Ctrl+Break中止宏运行的功能Application.Enable.CancelKey=xlDisabled禁止在单元格中直接编辑Application.EditDirectlyInCell=False\True屏幕刷新Application.ScreenUpdating=False\True指定对象禁用启用事件Application.EnableEvents=False\True禁用启用Esc键捕获功能Application.EnableCancelKey=xlDisabledApplication.EnableCancelKey=xlInterrupt关闭显示警告信息框Application.DisplayAlerts=False\True清空剪贴板Application.CutCopyMode=False\True安装指定加载宏Application.AddIns("加载宏名").Installed=True打开内置对话框Application.Dialogs(n).Show值n为:1---xlDialogOpen5---xlDialogSaveAs7---xlDialogPageSetup8---xlDialogPrint9---xlDialogPrinterSetup17---xlDialogRun23---xlDialogSetPrintTitles26---xlDialogFont27---xlDialogDisplay41---xlDialogTable42---xlDialogFormatNumber45---xlDialogBorder46---xlDialogCellProtection47---xlDialogColumnWidth52---xlDialogClear55---xlDialogInsert61---xlDialogDefineName84---xlDialogPatterns111---xlDialogDeleteFormat119---xlDialogNew127---xlDialogRowHeight189---xlDialogSendMail222---xlDialogPrintPreview229---xlDialogDefineStyle282---xlDialogWorkbookMove283---xlDialogWorkbookCopy302---xlDialogWorkbookNew342---xlDialogInsertPicture354---xlDialogWorkbookInsert386---xlDialogWorkbookName417---xlDialogWorkbookProtect476---xlDialogActiveCellFont509---xlDialogSetBackgroundPicture583---xlDialogConditionalFormatting596---xlDialogInsertHyperlink用户输入的对话框Selection.Value=Application.InputBox(Prompt:=myPrompt,Title:=myTitle,Type:=0)Selection.Value=Application.InputBox(Prompt:=myPrompt,Title:=myTitle,Type:=1)Selection.Value=Application.InputBox(Prompt:=myPrompt,Title:=myTitle,Type:=2)Application.InputBox(Prompt:=myPrompt,Title:=myTitle,Default:=myDefault,Type:=8)Application.InputBox(Prompt:=myPrompt,Title:=myTitle,Type:=1+2)Application.InputBox(Prompt:=myPrompt,Title:=myTitle,Default:=myDefault,Type:=2)显示消息对话框a=MsgBox("信息",x1+x2+x3+x4,"标题")x1为:0/vbOKOnly1/VbOKCancel2/VbAbortRetryIgnore3/VbYesNoCancel4/VbYesNo5/VbRetryCancelx2为:16/VbCritical32/VbQuestion48/VbExclamation64/VbInformationx3为:0/vbDefaultButton1256/vbDefaultButton2512/vbDefaultButton3768/vbDefaultButton4x4为:16384/vbMsgBoxHelpButton524288/vbMsgBoxRighta返回为:1/vbOK2/vbCancel3/vbAbort4/vbRetry5/vbIgnore6/vbYes7/vbNo运行宏Application.Run宏名一段时间后运行宏Application.OnTimeNow+TimeValue("00:00:05"),宏名某时间运行宏Application.OnTimeTimeValue("0:00:00"),宏名制定宏运行的时间 计划 项目进度计划表范例计划下载计划下载计划下载课程教学计划下载 Application.OnTimeEarliestTime:=NextTime,Procedure:="宏名"取消运行计划Application.OnTimeEarliestTime:=TimeValue("00:00:00"),Procedure:="宏名",Schedule:=False退出ExcelApplication.Quit第2章Wordbook(工作簿)对象工作簿名Workbooks(1).Name当前活动工作簿名ActiveWorkbook.NameThisWorkbook.Name当前完整路径的工作簿名ThisWorkbook.FullName本工作簿的基本名称Left(ThisWorkbook.Name,InStr(ThisWorkbook.Name,.)-1)工作簿路径Workbooks("工作簿").Path当前活动工作簿的路径ActiveWorkbook.PathThisWorkbook.Path新建工作簿Workbooks.Add打开工作簿Workbooks.OpenFilename:="路径",UpdateLinks:=xx为:0123打开工作簿(窗口选择)Workbooks.OpenFilename:=Application.GetOpenFilename("Excel工作簿(*.xls),*.xls")工作簿是否打开NotApplication.Workbooks("工作簿名")IsNothing=True工作簿打开方式Workbooks(1).ReadOnly=TrueWorkbooks(1).ReadOnly=False打开的工作簿数Workbooks.Count打开最近使用过的文件Application.RecentFiles(n).Open保存工作簿Workbooks("工作簿").Save另存工作簿并设密码ThisWorkbook.SaveAsFilename:="路径",WriteResPassword:="密码"另存工作簿(窗口选择)ThisWorkbook.SaveAsFilename:=Application.GetSaveAsFilename(,Excel工作簿(*.xls),*.xls)指定工作簿的副本保存到文件ThisWorkbook.SaveCopyAsFilename:="路径"保存自动恢复文件WithApplication.AutoRecover.Time=分钟.Path="路径"EndWith当前工作薄文件添加到收藏中ActiveWorkbook.AddToFavorites工作簿是否保存Workbooks("工作簿名").Saved=True/False工作簿最后保存时间Workbooks("工作簿名").BuiltinDocumentProperties("LastSaveTime")关闭工作簿ThisWorkbook.Closesavechanges:=False关闭所以工作簿Workbooks.Close保护撤消工作薄Workbooks(1).ProtectPassword:="***",Structure:=True,Windows:=TrueWorkbooks(1).UnprotectPassword:="***"窗格冻结ActiveWindow.FreezePanes=True/False结构窗口保护Workbooks(1).ProtectStructure=TrueWorkbooks(1).ProtectWindows=True窗口的标题ActiveWindow.CaptionWindows(1).CaptionApplication.Windows(1).Caption窗口拆分ActiveWindow.Split=True/FalseActiveWindow.SplitColumn=1ActiveWindow.SplitRow=1ActiveWindow.SplitHorizontalActiveWindow.SplitVertical窗口切换ActiveWindow.ActivateNextActiveWindow.ActivatePrevious窗口隐藏ActiveWindow..Visible=False/True新建窗口ActiveWindow.NewWindowWindows.ArrangeArrangestyle:=xlArrangeStyleVerticalActiveWindow.WindowState=xlMaximized重排窗口Windows.ArrangeActiveWorkbook:=TrueWindows.ArrangeArrangestyle:=xx为:xlArrangeStyleTiledxlArrangeStyleCascadexlArrangeStyleHorizontalxlArrangeStyleVertical显示比例ActiveWindow.Zoom=200ActiveWindow.Zoom=100设置工作簿视图选项ActiveWindow.DisplayFormulas=FalseActiveWindow.DisplayGridlines=FalseActiveWindow.DisplayHeadings=FalseActiveWindow.DisplayOutline=FalseActiveWindow.DisplayZeros=FalseActiveWindow.DisplayHorizontalScrollBar=FalseActiveWindow.DisplayVerticalScrollBar=FalseActiveWindow.DisplayWorkbookTabs=False设置网格线颜色ActiveWindow.GridlineColorIndex=nActiveWindow.GridlineColorIndex=xlColorIndexAutomatic判断工作簿是否加载宏Workbooks(1).IsAddin=True/False第3章Worksheet(工作表)对象判断是否是工作表Sheets(1).Type=xlWorksheet当前活动工作表名ActiveSheet.Name工作表数Worksheets.Count激活工作表Sheets(1).Activate选取工作表Sheets(1).Select新建工作表Worksheets.AddWorksheets.AddCount:=nWorksheets.Addafter:=Sheets(1)Worksheets.Addbefore:=Sheets(1)复制工作表Sheets(1).CopySheets(1).CopyAfter:=Sheets(1)Sheets(1).CopyBefore:=Sheets(1)移动工作表Sheets(1).MoveSheets(1).MoveAfter:=Sheets(2)Sheets(1).MoveBefore:=Sheets(3)删除工作表Sheets(1).Delete隐藏显示工作表Sheets(1).Visible=False/TrueSheets(1).Visible=xlSheetHidden/xlSheetVisibleSheets(1).Visible=xlSheetVeryHidden/xlSheetVisibleSheets(1).Visible=1/2保护工作表WithSheets(1).ProtectPassword:="***".ProtectContents:=True.ProtectDrawingObjects:=True.ProtectScenarios:=True.ProtectAllowDeletingColumns:=True.ProtectAllowDeletingRows:=True.ProtectAllowFiltering:=True.ProtectAllowFormattingCells:=True.ProtectAllowFormattingColumns:=True.ProtectAllowFormattingRows:=True.ProtectAllowInsertingColumns:=True.ProtectAllowInsertingRows:=True.ProtectAllowInsertingHyperlinks:=True.ProtectAllowSorting:=True.EnableSelection=xlNoSelection.EnableSelection=xlNoRestrictions.EnableSelection=xlUnlockedCells撤消工作表保护Sheets(1).UnprotectPassword:="***"自动筛选设置数据范围.AutoFilterField:=n,Criteria1:="=*字符*",VisibleDropDown:=True/False工作表处于筛选模式Sheets(1).FilterMode=True/False取消自动筛选Sheets(1).AutoFilterMode=False显示所有数据(同下拉列菜单全部)Sheets(1).ShowAllData重算工作表Sheets(1).EnableCalculation=TrueSheets(1).EnableCalculation=False显示所有工作标签CommandBars("WorkbookTabs").ShowPopup更改工作表表签颜色Sheets(1).Tab.ColorIndex=nn为:123456789xlColorIndexNone第4章Range(单元格)对象选取单元格[A1].Select[A1:D8].Select[A1:D8,A20:C25,F6:G10].Select[A:A].Select[A:D].Select[A:A,C:C,H:H].Select[1:1].Select[5:20].Select[1:1,3:3,5:5].SelectCells.Select选取与某值不同的单元格Sheets(1).Columns("A").ColumnDifferences(Comparison:=Sheets(1).[A1]).Select合并单元格区域Union(Range("A1:B10"),Range("D1:E10"),Range("G1:G10"))Range(Range("A1:B10"),Range("D1:E10"),Range("G1:G10"))活动单元格ActiveCell已用的单元格ActiveSheet.UsedRange空行围成的单元格[a1].CurrentRegion.Rows.Cells可视单元格区域ActiveWindow.VisibleRange公式引用的单元格[a1].PrecedentsApplication.Evaluate([a1].Formula)从属单元格[a1].Dependents特殊单元格选取Activesheet.cells.SpecialCells(x,y).Selectx为:xlCellTypeAllFormatConditionsxlCellTypeAllValidationxlCellTypeBlanksxlCellTypeCommentsxlCellTypeLastCellxlCellTypeVisible可见xlCellTypeSameFormatConditionsxlCellTypeSameValidationxlCellTypeConstantsxlCellTypeFormulas当x为xlCellTypeConstants或xlCellTypeFormulas时y为:xlErrorxlLogicalxlNumbersxlTextValues偏移单元格[a1].Offset(x,y)调整单元格Resize(x,y)单元格总数Sheet(1).Cells.CountA列最后非空一行Range("A65536").End(xlUp).Row第一行最后非空一列Range("IV1").End(xlToLeft).Column隐藏行列[a1].EntireRow.Hidden=True/False[a1].EntireColumn.Hidden=True/FalseRows(1).Hidden=True/FalseColumns(1).Hidden=True/FalseRows.Hidden=True/FalseCells.Rows.Hidden=True/FalseColumns.Hidden=True/False设置行高列宽[A1].RowHeight=n[A1].ColumnWidth=n设置列宽行高(厘米)Application.CentimetersToPoints(1)Application.CentimetersToPoints(2)设置列宽行高(英寸)Application.InchesToPoints(1)Application.InchesToPoints(0.5)自动调整单元格[A1].EntireColumn.AutoFit[A1].EntireRow.AutoFit设置滚动区域Sheets(1).ScrollArea=[a1]Sheets(1).ScrollArea=""输入公式[a1].Formula="=TODAY()"是否有公式单元格[a1].HasFormula=True/False是否有数组公式单元格[a1].HasArray=True/False设置为数组公式[A1].FormulaArray="数组公式"单元格引用样式[A1].Address[A1].Address(False,False)[A1].Address(RowAbsolute:=False)[A1].Address(ColumnAbsolute:=False)[A1].Address(ReferenceStyle:=xlR1C1)[A1].Address(False,False,ReferenceStyle:=xlR1C1)[A1].Address(RowAbsolute:=False,ReferenceStyle:=xlR1C1)[A1].Address(ColumnAbsolute:=False,ReferenceStyle:=xlR1C1)单元格剪切[A1].CutDestination:=[b1]单元格复制[A1].CopyDestination:=[b1][A1].Copy[b1]将单元格复制成图片[A1].CopyPicturexlScreen,xlBitmap[B1].Select[B1].Parent.Pictures.Paste选择性粘贴[A1].Copy[B1].PasteSpecialPaste:=x,Operation:=y,SkipBlanks:=True/False,Transpose:=True/Falsex为:xlPasteAllxlPasteAllExceptBordersxlPasteColumnWidthsxlPasteCommentsxlPasteFormatsxlPasteFormulasxlPasteFormulasAndNumberFormatsxlPasteValidationxlPasteValuesxlPasteValuesAndNumberFormatsy为:xlPasteSpecialOperationNonexlPasteSpecialOperationAddxlPasteSpecialOperationSubtractxlPasteSpecialOperationMultiplyxlPasteSpecialOperationDivide插入行列[A1].InsertShift:=xlToRight[A1].InsertShift:=xlDown[A1].EntireRow.InsertShift:=xlShiftDown[A1].EntireColumn.InsertShift:=xlShiftToRight删除行列[A1].DeleteShift:=xlUp[A1].DeleteShift:=xlToLeft[A1].EntireRow.DeleteShift:=xlUp[A1].EntireColumn.DeleteShift:=xlToLeft清除单元格[A1].ClearFormats[A1].ClearContents[A1].ClearComments[A1].ClearNotes[A1].Clear拼音指南[a1]="拼音"[a1].Characters(1,3).PhoneticCharacters="pinyin"[a1].Phonetic.Visible=True批注设置With[a1].Comment.Delete.AddComment.Text/"批注内容".Comment.Visible=False.Comment.TextText:="插入内容",Start:=1,EndWith[a1].NoteText超链接设置Sheets(1).Hyperlinks.DeleteSheets(1).Hyperlinks.AddAnchor:=[a1],Address:="",Sheets(1).Hyperlinks.AddAnchor:=[a1],Address:="路径",ScreenTip:="屏幕文字提示"数据有效性设置[a1].Validation.AddType:=x,AlertStyle:=_xlValidAlertStop,Operator:=y,Formula1:="100"x为:xlValidateWholeNumberxlValidateDecimalxlValidateDatexlValidateTimexlValidateTextLengthxlValidateListy=xlEqual,Formula1:="1,2,3,4,5,6,7,8,9,10,11,12"y=xlBetween,Formula1:="=$D$1:$D$10"y为:xlBetween后面加:Formul2:="1000"xlGreaterxlLessxlGreaterEqualxlLessEqualxlNotEqualxlEqual.IgnoreBlank=True.InCellDropdown=True.InputTitle="整数".ErrorTitle="数据错误".InputMessage="请输入整数".ErrorMessage="数据超出了范围".IMEMode=xlIMEModeOff.ShowInput=True.ShowError=True单元格填充设置[A1:A20].Cells(1).Value=x[A1:A20].Cells(1).AutoFillDestination:=[A1:A20],Type:=yy为:xlFillDaysx为日期型xlFillFormatsxlFillSeriesx为数值/公式xlFillWeekdaysx为日期型xlGrowthTrendxlFillCopyxlFillDefaultxlFillMonthsx为日期型xlFillValuesx为数值/公式xlFillYearsx为日期型xlLinearTrend单元格数字设置[a1].NumberFormatLocal=xx为:G/通用格式0_#,##0.00_);[红色](#,##0.00)yyyy-m-dh:mm:ss0#?/?##0.0E+0@[DBNum1][$-804]G/通用格式[DBNum2][$-804]G/通用格式单元格对齐设置[A1].HorizontalAlignment=xx为:xlHAlignLeftxlHAlignRightxlHAlignCenterxlHAlignFillxlHAlignCenterAcrossSelectionxlHAlignDistributedxlHAlignGeneralxlHAlignJustify[A1].VerticalAlignment=xx为:xlVAlignCenterxlVAlignJustifyxlVAlignBottomxlVAlignDistributedxlVAlignTop[A1].Orientation=0°~360°[A1].AddIndent=True[A1].WrapText=True[A1].ShrinkToFit=True[a1:a2].Merge[a1:a2].UnMerge[a1].MergeCells=True单元格字体设置[a1].Font.Name字体名称#VALUE![a1].Font.Size=n[a1].Font.ColorIndex=n[a1].Font.Underline=xx为:xlUnderlineStyleNonexlUnderlineStyleSinglexlUnderlineStyleDoublexlUnderlineStyleSingleAccountingxlUnderlineStyleDoubleAccounting[a1].Font.Strikethrough=True/False[a1].Font.Subscript=True/False[a1].Font.Superscript=True/False单元格边框设置[a1].Borders(x).ColorIndex=n[a1].Borders(x).LineStyle=y[a1].Borders(x).Weight=zx为:xlEdgeTopxlEdgeBottomxlEdgeLeftxlEdgeRightxlDiagonalDownxlDiagonalUpxlInsideHorizontalxlInsideVerticaly为:xlContinuousxlDoublexlDashxlDashDotxlDashDotDotxlDotxlSlantDashDotxlLineStyleNonez为:xlHairlinexlThinxlMediumxlThick单元格图案设置[a1].Interior.ColorIndex=n[a1].Interior.Pattern=n[a1].Interior.PatternColorIndex=n单元格保护设置[a1].Locked=True/False[a1].FormulaHidden=True/False第5章Chart(图表)对象图表属性WithSheets(1).ChartObjects(1).Name.Left.Top.Height.Width.Chart.ChartType返回值:xlLinexlLineMarkersStackedxlLineStackedxlPiexlPieOfPiexlPyramidBarStackedxlPyramidColxlPyramidColClusteredxlPyramidColStackedxlPyramidColStacked100xlRadarxlRadarFilledxlRadarMarkersxlStockHLCxlStockOHLCxlStockVHLCxlStockVOHLCxlSurfacexlSurfaceTopViewxlSurfaceTopViewWireframexlSurfaceWireframexlXYScatterxlXYScatterLinesxlXYScatterLinesNoMarkersxlXYScatterSmoothxlXYScatterSmoothNoMarkersxl3DAreaxl3DAreaStackedxl3DAreaStacked100xl3DBarClusteredxl3DBarStackedxl3DBarStacked100xl3DColumnxl3DColumnClusteredxl3DColumnStackedxl3DColumnStacked100xl3DLinexl3DPiexl3DPieExplodedxlAreaxlAreaStackedxlAreaStacked100xlBarClusteredxlBarOfPiexlBarStackedxlBarStacked100xlBubblexlBubble3DEffectxlColumnClusteredxlColumnStackedxlColumnStacked100xlConeBarClusteredxlConeBarStackedxlConeBarStacked100xlConeColxlConeColClusteredxlConeColStackedxlConeColStacked100xlCylinderBarClusteredxlCylinderBarStackedxlCylinderBarStacked100xlCylinderColxlCylinderColClusteredxlCylinderColStackedxlCylinderColStacked100xlDoughnutxlDoughnutExplodedxlLineMarkersxlLineMarkersStacked100xlLineStacked100xlPieExplodedxlPyramidBarClusteredxlPyramidBarStacked100图表标题属性WithSheets(1).ChartObjects(1).Chart.HasTitle=TrueWith.ChartTitle.Name.Text.Font.Name.Font.Size.Font.ColorIndex.Interior.ColorIndex.Left.TopEndWithEndWith图表图例属性WithSheets(1).ChartObjects(1).Chart.HasLegend=TrueWith.Legend.Name.Font.Name.Font.Size.Font.ColorIndex.Interior.ColorIndex.Left.TopEndWithEndWith坐标轴属性WithSheets(1).ChartObjects(1).Chart.Axes(x)x为:xlValuexlCategory.HasTitle=True.AxisTitle.Text.MinimumScale.MaximumScaleWith.TickLabels.Font.Name.SizeEndWithEndWith趋势线属性WithSheets(1).ChartObjects(1).Chart.SeriesCollection(1).Trendlines(1).Type返回值:xlExponentialxlLinearxlLogarithmicxlMovingAvgxlPolynomialxlPower.DisplayRSquared=True.DisplayEquation=True.DataLabel.Text绘图区属性WithSheets(1).ChartObjects(1).Chart.PlotArea.Height.Width.Interior.ColorIndexWith.Border.LineStyle.Weight.ColorIndexEndWithWith.Font.Name.Size.ColorIndexEndWith创建图表WithCharts.Add.ChartType="图表类型".SetSourceDataSource:="数据源",PlotBy:=xlRows/xlColumnsWith.SeriesCollection(1).XValues="数据源".Values="数据源".Name="图表名称".ApplyDataLabelsAutoText:=True,ShowValue:=TrueEndWith.LocationWhere:=xlLocationAsObject,Name:="图表名称"EndWith图表另存为图片WithSheets(1).ChartObjects(1).Chart.ExportFilename:="路径"&\&名称.jpg,Filtername:="JPG"EndWith图表添加入批注WithSheets(1).[a1].AddComment.Shape.Height=n.Width=n.Fill.UserPicture路径&\&名称.jpgEndWithSheets(1).[a1].Comment.Visible=False插入图表WithSheets(1).Pictures.Insert路径&\&名称.jpg.Left=n.Top=nEndWith第6章Shape(图形)对象图形属性WithSheets(1).Shapes(1).Name.Type返回值:msoShapeTypeMixedmsoAutoShapemsoCalloutmsoChartmsoCommentmsoFreeformmsoGroupmsoFormControlmsoLinemsoLinkedOLEObjectmsoLinkedPicturemsoOLEControlObjectmsoPicturemsoTextEffectmsoTextBoxmsoDiagram.TextEffect.Text.TextFrame.Characters.Text.Height.Width.Left.Top.TopLeftCell.Address.BottomRightCell.Address.OnAction.Delete添加艺术字WithSheets(1).Shapes.AddTextEffect(x,"文本",字体,大小,加粗,斜体,Left,Top)x为:msoTextEffect1~30添加自选图形WithSheets(1).Shapes.AddShape(Type:=x,Left:=n,Top:=n,Width:=n,Height:=n)x为:msoShapeActionButtonBeginningmsoShapeActionButtonEndmsoShapeActionButtonBackorPreviousmsoShapeActionButtonForwardorNextmsoShapeActionButtonDocumentmsoShapeActionButtonHomemsoShapeActionButtonMoviemsoShapeActionButtonSoundmsoShapeActionButtonHelpmsoShapeActionButtonInformationmsoShapeActionButtonReturnmsoShapeBalloonmsoShapeCloudCalloutmsoShapeOvalCalloutmsoShapeCurvedRightArrowmsoShapeCurvedDownArrowmsoShapeCurvedLeftArrowmsoShapeCurvedUpArrowmsoShapeLeftArrowmsoShapeLeftRightArrowmsoShapeRightArrowmsoShapeBentUpArrowmsoShapeLeftRightUpArrowmsoShapeLeftUpArrowmsoShapeNotchedRightArrowmsoShapeStripedRightArrowmsoShapeUpArrowCalloutmsoShapeDownArrowCalloutmsoShapeQuadArrowmsoShapeDownArrowmsoShapeUpArrowmsoShapeCubemsoShapeFlowchartDirectAccessStoragemsoShapeCanmsoShapeFlowchartPredefinedProcessmsoShapeUpRibbonmsoShapeDonutmsoShapeFlowchartOrmsoShapeFlowchartSummingJunctionmsoShapeNoSymbolmsoShapeFlowchartProcessmsoShapeBevelmsoShapeFlowchartAlternateProcessmsoShapeRectanglemsoShapeRoundedRectanglemsoShapeFlowchartDelaymsoShapeOctagonmsoShapeFlowchartConnectormsoShapeOvalmsoShapeDiamondmsoShapeFlowchartExtractmsoShapeFlowchartMergemsoShapeRightTrianglemsoShapeTrapezoidmsoShapeFlowchartDatamsoShapeHeartmsoShapeHexagonmsoShapeRegularPentagonmsoShapeMoonmsoShapeSmileyFacemsoShapeSunmsoShape5pointStarWith.TextFrame.Characters.Text="文本".HorizontalAlignment=xlHAlignCenter.VerticalAlignment=xlCenterEndWithWith.TextFrame.Characters.Font.Name="华文行楷".FontStyle="常规".Size=x.ColorIndex=nEndWith.SelectWithSelection.ShapeRange.Fill.Transparency=n.Visible=msoTrue.ForeColor.SchemeColor=n.BackColor.SchemeColor=n.OneColorGradient/TwoColorGradientx,y,z/省略x为:msoGradientDiagonalDownmsoGradientDiagonalUpmsoGradientFromCentermsoGradientFromCornermsoGradientFromTitlemsoGradientHorizontalmsoGradientMixedmsoGradientVerticaly值为:1~4(x为msoGradientFromCenter时y值为:1~2)z值为:0.0~1.0EndWithWithSelection.ShapeRange.Line.Weight=0.75.DashStyle=msoLineSolid.Style=msoLineSingle.Transparency=n.Visible=msoTrue.ForeColor.SchemeColor=n.BackColor.RGB=RGB(255,255,255)EndWith.OnAction="宏名"EndWith图形翻转Sheets(1).Shapes(1).Flipxx为:msoFlipHorizontalmsoFlipVertical图形旋转#NAME?Sheets(1).Shapes(1).IncrementRotationn.ThreeD.IncrementRotationX±n.ThreeD.IncrementRotationY±nn为:旋转度数图形位置属性Sheets(1).Shapes(1).Placement=xx为:xlMoveAndSizexlFreeFloatingxlMove第7章窗体控件工作表中插入Shape对象控件1WithSheets(1).AddFormControl(x,Left,Top,Width,Height)x为:xlButtonControlxlCheckBoxxlDropDownxlLabelxlListBoxxlOptionButtonxlScrollBarxlSpinnerEndWith工作表中插入Shape对象控件2Sheets(1).x.Add(Left,Top,Width,Height)x为:ButtonsCheckBoxesDropDownsLabelsListBoxesOptionButtonsScrollBarsSpinnersShape对象按钮控件设置WithSheets(1).Shapes(1).TextFrame.Characters.Text="***".Width=n.Height=n.Top=n.Left=nWith.TextFrame.Characters.Text="技巧7_017".Font.Size=26.Font.ColorIndex=3EndWithEndWithShape对象复选框与选项按钮控件设置WithSheets(1).Shapes(1).Delete.ControlFormat.Value=1.ControlFormat.Value=-4146EndWithShape对象复合框与列表框控件设置WithSheets(1).Shapes(1).ControlFormat.ListFillRange=Sheets(1).Name&!A1:A2.ControlFormat.AddItemCells(i,1).value.List=Cells(i,1).value.ControlFormat.LinkedCell=ws.Name&!A1S
本文档为【vba的对象属性大全】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: ¥15.0 已有0 人下载
最新资料
资料动态
专题动态
个人认证用户
百万精品文库
暂无简介~
格式:xls
大小:211KB
软件:Excel
页数:30
分类:修理服务/居民服务
上传时间:2022-09-11
浏览量:10