Recently in the project, to achieve the automatic generation of contracts, and then want to use VBA for the contract (Word version) in the same place in the bulk of the replacement.The field in the Word document is replaced by a label. The code is as follows:Public Function Updatebookmarkloop (app as Object, bookmarkbase as String, nvalue as Variant, bot as long, top as long) Dim counter As Long Dim name as String counter=1For counter=bot to top name=
The account manager visits a lot of customers every month, the company requires a visit record summary table and to make a visit to the customer's sub-table, so that the supervisor spot checks, the structure of a table. At this time, if a customer fills in a customer, it is very annoying and time consuming. We can do a VBA button, each month as long as the summary part is filled out, just click on the button, automatically generate and customer info
use Excel VBA programming to draw a hexagon on a form. This tutorial is to share with friends the use of Excel VBA programming on the form to draw a hexagonal method, the tutorial is very good, suitable for beginners to learn, recommend you to see it.
Step 1
Open the Excel table and enter the VBE window.
Insert the module.
Programming in Module 1, declaring 4 functions, a structu
= Strresult
' The data in cell D1
Range ("D1″"). Value = Left (Range (A1″), StartNum-1)
' The data in cell E1
Range ("E1″"). Value = Right (range (B1″), Len (range ("B1″)"-j)
End Sub
The code is simple, using just a few VBA functions.
Discuss:
In fact, the code can be further simplified because VBA also has an array function (the Split function).
If you want to make it generic, you can convert the
We introduced the service tag using the MEX contract to invoke the WCF service in COM in such a way that it is convenient to obtain metadata dynamically through the MEX endpoint, but sometimes the metadata of the service may contain sensitive information about the application that a malicious user can exploit. This means that some services may not publish metadata information through Mex for security reasons. If oh, some services do not publish metadata information, with typing is more cumbersom
Download the workbook online, found that there is a password!xxoo, since put on the Internet why to add a password ah?! Later on the internet to find a way to use VBA to crack the worksheet password, to share.
First, when you try to open the workbook, you are prompted with a password:
Using the shortcut key ctrl+f11, open the VBA editing interface and tap the submenu "module" under the "Insert
IamlaosongThere is a pick report, want to first from the product information to separate the color information, and then based on the storage, name and color to create a pivot table, because the data is changed (structure is unchanged, the number of records will change), each re-creation is cumbersome, so want to make a tool, use VBA to separate colors and create a PivotTable report for others to The code that separates the colors is very good to writ
A procedure is a collection that executes one or more given tasks.into: subroutines and functions.1. Sub-Program[Private| Public | Friend] [StaticSub name [(arglist)][staements][Exit Sub][statements]End SubFriend indicates that the sub is visible throughout the project, but object instance controllers are not visible2. function, with return value[Private| Public | Friend] [StaticSub name [(arglist)] [ as type][statements][name= expression][Exit Function][statements][name = expression]End Funct
The difference between ByVal and ByRef
To say that the difference between the two is what it is passing, perhaps this sentence is very vague, let us explain.1, byval-by value, that is to say, we pass to the function is a simple numerical past, the following code to help us understand:
The code is as follows
Copy Code
Sub Run ()Dim I as Integeri = 1Add IMsgBox IEnd SubSub Add (ByVal i as Integer)i = i + 3End Sub
The code above, the I value shown in the fina
In VBA programming, there are also debug features that are used, but are somewhat different from C # and C + +. Especially when you watch an object, you must select it, and then press shift +F9 to make quick watch. Please note the following points:
Insert a breakpoint, put the mouse in front of a line of code, left mouse click can insert a breakpoint, cancel a breakpoint just click on the breakpoint on the left mouse button OK
Single-Step ――――f8. Yo
Functional function DLookup (strfieldname, strTableName, strwhere, objconn)
' Refer to the DLookup function in Access VBA
' Because the environment is different, add the objconn parameter, direct adodb.connection direct redeployment to
Dim strSQL
Dim RS
Set rs = server. CreateObject ("Adodb.recordset")
' Next to call a custom function outside the Checksql ()
strFieldName = Checksql (strfieldname)
If strwhere strwhere = "where" Strwhere
End If
Strsql=
We'd better use the Sina Weibo open platform API to collect, of course, the API must have the app key
Take the following procedure:
1. We know that VBA acquisition data often use an object is the Microsoft.XMLHTTP object, this time also use the object, so we first use VBA to create an object, as shown in the code is to create a Microsoft.XMLHTTP object
2. Then, we casually find an interface, such as we
In the new Office 2013 version, because of battery life and machine reliability, the removal of features such as macros, Third-party add-ons, and VBA will replace them with a new "cloud app model", a link between Microsoft and developers, and marketing/sales/ Deployment and other software aggregation.
Developers have 80% of the gains from the platform, of which 20% are owned by Microsoft. The new version of Office is able to use the web as a workarou
IamlaosongA very simple function, there are many online generators, there are also gadgets can be downloaded, here with VBA to do one, the results are saved to the current worksheet, simple, fast. The build function can also be used in other programs. The process of implementing a function is to use a variable to hold all the characters used, and then to take different substrings according to the level, and then to generate random numbers, and remove
Manually set up PowerDesigner tables and columns is very troublesome, so think with VBA implementation, reference http://www.pudn.com/downloads447/sourcecode/database/detail1884121.html, as follows:To create a table:Set mdl = ActivemodelSet table = mdl. Tables.createnewTable. Name = "TableName"Table. Code = "Table"To create a column:For all Tab in Folder.tablesDim colSet Col =tab.columns.createnewCol.name= "ColumnName"Col.code= "ColumnName"Col.comment
vbMsgBoxSetForeground
65535
Specify dialog window as foreground window
vbMsgBoxRight
524288
The text of the dialog box is right-justified
Vbmsgboxrtireading
1048576
Specifies that the elements in the dialog box are displayed from right to left
Description(1) The first set of values (0–5) describes the type and number of buttons displayed in the message box, the second set of values (16,32,48,64) describes the style
informationActivesheet. PasteDim N as integerN = baselineStartline1 = n' the starting line for the parent account to Start copying
'Open each subaccount and copy the information to the parent accountFor I = 1 to countWorkbooks. Open filename: = currentpath Arr (I) 'Open the Excel file cyclicallySheets (1). SelectN = baseline'Start from the third line and find the end line of the subaccount InformationWith sheets (1)Do while. cells (n, 1). Text N = n + 1LoopEndStartline2 = n-1 'subaccount copy
Excel2007 is used as an example:
"Available macro loading" shortcut -- Alt + T + I
Microsoft Visual Basic -- Alt + F11
1: Open the VBA programming window through the shortcut key (Alt + F11;
2: Right-click the corresponding sheet and choose insert-module ";
3: Add the following code to the new "module" to run the sub-process;
1 Function PinYin(Hz As String) 2 Dim PinMa As String 3 Dim MyPinMa As Variant 4 Dim Temp As Integer, i As
Technorati labels: relationship, access, VBA, index, ADO
From: julitta korol, "access.2003.programming. By. example. With. VBA. xml. And. asp", by wordware Publishing, Inc. 2005, p212-p220
(1)Primary KeyIs an index with its unique and primarykey properties set to true. There can beOnly one primary key per table. A primary keyUniquely identifies a row in a table.
To create new keys, use the key object from t
Workbooks. opentext (filename, origin, startrow, ype, textqualifier, delimiter, tab, semicolon, comma, space, other, otherchar, fieldinfo, textvisuallayout, delimiter, thousandsseparator, delimiter, local)
For more information about the meanings of the preceding parameters, see the help of VBA. In actual programming, it is generally not necessary to process these complex parameters. You can use a recording macro to obtain the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.