I have been studying VBA and writing reports recently. I would like to sum up my knowledge and experience and share it with you.
Tools, VBA
1. One of the best functions of Excel is to record macros. When a function is not sure how to write it, recording will be very helpful when it is represented by a function.
2. Compared with the recording macro, VBA can be mor
1 week ago I still in a wonderful city for business trips, that's a great trip I been through so far. So great for the city and my colleagues, I still remember it from time to time~Ok, today I inadvertently saw some posts regarding to split excel sheets to workbooks, I thought someday I'll face the S Ame situation in the future from others. So, I gave it a shot to achieve in PowerShell and VBA, as a solution for my future customers.PowershellFirst of
-clsid { d824b185-ae3c-11d6-abf5-00b0d07b8581}-out. -reg F:/excelvba/excelvba.jar jp.co.esm.pmt.pmtbean-2. Write the VBA in Excel.
(2) J-integra offers two solutions.
Pre-binding and late binding. Late binding no need to know the Java object information of the communication, after registering the Java object to the virtual machine (using the J-integra tool), you can dynamically find the object at run time.
Early binding is faster than late binding, bu
Always declare your variables correctly!
To quickly view a variables definition:Select the variable that you want the definition.GoView> definition (SHIFT + F2)
To return to your previous position:GoView> last postition (CTRL + Shift + F2).
Release memory from Object variables:
Sub ReleaseObjectMemory() 'Could be any variable of the Object type Dim wSheet as Worksheet 'Set Object variable Set wSheet = Sheet1 'Your code here. 'Release memory Set wSheet = NothingEnd Sub
Don't get caugh
reduced by oneAssuming that the assignment range is represented by a row and column number, the following statement (Pos_fst, Pos_ems is two parameters, each of which is the starting row of the data and the columns of data ):MaxRow = Cells (65536, Pos_ems). End (Xlup). RowMail = Range (Cells (pos_fst, pos_ems), cells (MaxRow, pos_ems))using the above routine, it was found that the first method was very small (4.62963E-05), even if the 20多万条 data were
IamlaosongI do Excel tools, connect Oracle database query data, usually can run very well, both XP and Win7 can. Later encountered a Win7 (64-bit) system, found unable to connect to the database, reported " connection is not open" error .error Description: Sqlplus can be connected with Oracle's tool, but the macro in Excel is "ORA-06413: Connection not open" Error . such as:Click Debug, the Error statement is:Cnn. Open "Provider=msdaora;data source=dl
Yesterday afternoon began to learn the VBA, exhausted, there must be bugs, to be debuggedThe VBA program is as follows:1 DimAsum as Integer2 DimTSum as Integer3 DimJudge -) as Integer4 DimArrmax as Integer5 Dimarr6 DimLocation -) as Integer7 8 FunctionTest ()9 DimArrwmax as IntegerTen DimRng asRange One DimBeginrow as Integer A DimBeginline as Integer - - SetRng = Application.inputb
0, return off. Otherwise, return onFormat $ ("100123", "Yes/No") Return Value onCustom format parameters"" Original value returned without formatting0 placeholder formatting, less than 0Format $ ("100123", "0000000") returns 0100123# Placeholder formatting. If not, do not add 0.Format $ ("100123", "######") Return Value 100123. Forcibly display the decimal pointFormat $ ("100123.12", ". 000") returns 100123.120% Is converted to a percentage. A % Represents multiplied by 100.Format $ ("10.23", "
string into a hirakana character.
Vbunicode 64 converts a string to Unicode based on the system's default code page.
Vbfromunicode 128 converts a string from Unicode to the default code page of the system.
* Apply to the far east country.
** Only applicable to Japan.
Note that these constants are specified by VBA. They can be used in programs to replace real values. Most of them can be combined, such as vbuppercase + vbwide. mutex constants cann
= " Datfullname cnn2
. Open cnnstr
Windows (datfile). Activate
stname = activesheet.name
sqls = "Select message number, recipient name from [" Stname "$]"
Debug.Print sql s
Set rst2 = cnn2. Execute (SQLS) while not
Rst2. EOF
Debug.Print rst2 (0) Rst2 (1)
rst2.movenext
wend
End Sub
A few notes: 1. The data file "ID address 1.xls", which is read in this routine, is open for the purpose of fetching the name of the worksheet. In terms of reading the da
First, primary knowledge classNow, please open your VBE, main menu-Insert-class module.A class module is inserted, and a class is created. The name of the class module is the name of the class. What you see now, her name is "Class 1", this is VBA according to her sister ranked her, yes, VBA has always been so, you are familiar with this rule, now, in the standard module or other modules to enter the Dim ...
Many people must know about macros and may have used macros. What is Macros? A macro is a program compiled by VBA. It is a series of commands and functions stored in the Visual Basic module and can be run at any time when the task needs to be executed. How to start learning VBA? This is one of the frequently asked questions of many friends. I personally think that the best way to learn something is to start
I learned to use VBA to connect to PHP's API, which is what my php function says:
public function vba() { echo 170982358; }
Using the thinkphp to change the routing rules, the function is made into a page.
But when called with VBA, this is the case:
Although also returned the result 170982358, but the mess;
But the other people's API returne
Translator Note:This article is greatly accompanied by translation from the www.vba-ie.net of the course, only to do Japanese learning, such as reproduced in this article please inform. all of the text is not replaced with Chinese interface, because the author of the computer is also a Japanese system, hope to understand. As a primer, this tutorial covers the basics of controlling IE from using VBA, getting data from a Web page , to a broader range of
Data | database
Integrated examination system of computer culture base based on database, OLE and VBA technology
Chen Cli
Content Summary: This paper introduces the integration examination system developed by using database technology, Object linking technology (OLE) and VBA programming in VB, so as to realize the paperless examination and automatic marking of theoretical knowledge and operation skill in
Recently, I used Excel VBA to create a "supply, sales, and storage management system" for the purchasing department. As a result, the "Project or database cannot be found" error occurs on the computer of the purchasing department. Generally, this error occurs because the referenced project cannot be found or the referenced Object Library corresponding to the engineering language cannot be found. This error also occurs when you install the Office Lite
The VBA basics are coming to an end in everyone's attention. There are many classic VBA operations that we just briefly introduce, to use VBA skillfully, You need to digest and absorb it slowly, and then summarize and improve it in practice. Finally, we collected common VBA code to attract a large number of readers and
This article describes three different ways that VBA refers to a worksheet name.VBA reference worksheets are very common in the process of learning VBA.This article provides three types of VBA reference worksheets, which are all three ways to implement VBA referencing a worksheet name.Method One: Sheets (Sheet.index)Method Two: Sheets (sheets.name)Method Three: S
context, expression, and value of the expression.
4. Press Ctrl + G to display the "window now ". It has four main functions:
(1). Print Information
In the window, enter Debug. Print expression 1; expression 2 ...... to display the values of each expression!
2. You can assign values to variables or attributes!
Example: form1.backcolor = 255
Maxrows = 50
3. You can test the process.
In this window, you can directly enter the process name and actual parameters to call the process.
For example:
My
This Code reads all files in a folder, and can also filter other formats based on the extension.'With the file name, open the file, get the sheet name of each file, and write it to the desired place.
Sub macro1 ()Dim mydialog as filedialog, ofile as object, strname as string, N as integerDim FSO as object, myfolder as object, myfiles as object, dim FN $Set mydialog = application. filedialog (msofiledialogfolderpicker)N = 1With mydialogIf. Show lt; gt;-1 then exit subSet FSO = Createobject ("sc
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.