Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
khi bạn đang làm việc với các tập tin được giới hạn mà bạn mở bằng cách sử dụng VBA Mở tuyên bố (chứ không phải là phương pháp OpenText của đối tượng Workbooks). Cú pháp chia như sau.Các thông số của Tách được giải thích trong danh sách sau đây. Biểu hiện Biểu hiện là một tham số cần thiết. Đó là chuỗi mà bạn muốn tách ra. | summary 347 when you are working with delimited files that you open using the VBA Open statement rather than the OpenText method of the Workbooks object . The syntax of Split is as follows. Split Expression Delimiter Limit Compare The parameters of Split are explained in the following list. Expression Expression is a required parameter. It is the string that you would like to split apart. Expression should be a string consisting of subparts and delimiters such as one line from a delimited text file. Delimiter Delimiter is an optional parameter. Set the Delimiter parameter equal to the character used to delimit the string given by Expression. By default Split assumes that Expression is space delimited. Limit Limit is an optional parameter that can be used to specify how many subparts to return. Compare Compare is an optional parameter that can be used to specify the type of comparison to use when comparing substrings. Use one of the following vbUseCompareOption vbUseBina-ryCompare vbUseTextCompare or vbUseDatabaseCompare. Summary Working with text files can be more tedious than working with other data transfer mechanisms such as using a database or XML. Nonetheless working with text files offers some advantages. For one text files are universally supported. If you need to get data from one application to another if nothing else you can export data to text and then import it in the other application. Another advantage of using text files is that Excel can open delimited and fixed-width files without writing any special VBA code. Yet another advantage of using text files is that operations on text files are fast. You can use text files in your application in two ways. One way is to open the text file in Excel much like you would an Excel workbook. You can open the file manually or you can open it programmatically using the OpenText method of the Workbooks object. The second way to use a text file can only be achieved programmatically you open the text file using VBA s