![]() ![]() ![]() (In fact, the automation of repetitive tasks is one of the most common uses of VBA in Office.)īeyond the power of scripting VBA to accelerate every-day tasks, you can use VBA to add new functionality to Office applications or to prompt and interact with the user of your documents in ways that are specific to your business needs. Further, if it can be done once with VBA, it can be done just as easily a hundred times. ![]() The great power of VBA programming in Office is that nearly every operation that you can perform with a mouse, keyboard, or a dialog box can also be done by using VBA. There are many different ways to author, format, and manipulate documents, email, databases, forms, spreadsheets, and presentations. The Office suite of applications has a rich set of features. This article is for experienced Office users who want to learn about VBA and who want some insight into how programming can help them to customize Office. You can perform these tasks and accomplish a great deal more by using Visual Basic for Applications (VBA) for Office-a simple, but powerful programming language that you can use to extend Office applications. Position (struct) position of control element ( .Are you facing a repetitive clean up of fifty tables in Word? Do you want a particular document to prompt the user for input when it opens? Are you having difficulty figuring out how to get your contacts from Microsoft Outlook into a Microsoft Excel spreadsheet efficiently? Size (struct) size of control element ( .Size data structure) The control element shape, like all other shape objects, provides the Size and Position properties for this purpose: If this is true, the function ends the search.ĭetermining the Size and Position of Control ElementsĪs already mentioned, the size and position of control elements can be determined using the associated shape object. If this is the case, the Control.Name property then checks whether the name of the control element is MyListBox. The example checks all drawing elements to determine whether they support the .XControlShape interface needed for control element forms. Name = "MyListBox" Then Exit Function End If End If Next ![]() DrawPage (i ) If HasUnoInterfaces (Shape, ".XControlShape" ) Then If Shape. To determine a special control element, all drawing elements of the drawing level must be searched through.ĭim Doc As Object Dim Shape as Object Dim I as integerĭoc = ThisComponent For i = 0 to Doc. The method for accessing the shape objects of a control element also uses the corresponding drawing level of the document. With the help of this controller object and the model of the control element, it then uses the GetControl method to determine the view ( CtlView variable) of the control element form.Īccessing the Shape Object of Control Element Forms It uses not only the Doc document object but also the DocCrl document controller object which makes reference to the current document window. The code listed in the example is very similar to the code listed in the previous example for determining a control element model. GetControl (Ctl ) Exit Function End If Next I HasByName ( "MyListBox" ) ThenĬtlView = DocCrl. The models of the control elements of a form are available through the GetByName method of the Object form:ĭim Doc As Object Dim DocCrl As Object Dim Forms As Object Dim Form As Object Dim Ctl As Object Dim CtlView As Object Dim I as Integerįorms = Doc. Since control element forms within the documents are administered like a special drawing element, there is also a Shape object which reflects the drawing element-specific properties of the control element (in particular its position and size).Īccessing the Model of Control Element Forms.The counterpart to this is the View of the control element, which administers the display information.The Model of the control element is the key object for the Apache OpenOffice Basic-programmer when working with control element forms.The Three Aspects of a Control Element FormĪ control element of a form has three aspects: The option of creating sub-forms is also provided for this purpose. This is useful, for example, if the contents of different databases are displayed within one document, or if a 1:n database relationship is displayed within a form. Dim Doc As Object Dim Sheet As Object Dim DrawPage As Object Dim Form As ObjectĪs is already suggested by the GetByIndex method name, a document may contain several forms. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |