Đang chuẩn bị liên kết để tải về tài liệu:
Mastering Excel 2003 Programming with VBA phần 3

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

không hợp lệ 'thư khac - không thay đổi bất cứ điều gì Cuối Nếu End Sub' Trả về vị trí hoặc chỉ số của nhân vật đầu tiên của tên tập tin một tên đầy đủ "tên đầy đủ bao gồm một con đường và một tên tập tin Ex.Ngoài ra để cung cấp cho bạn một cách hữu ích để cô lập các thành phần đường dẫn và tên file từ một tên tập tin đầy đủ, | common file operations simplified 103 sPath Left sFullName nPos - 1 Else Invalid sFullName - don t change anything End If End Sub Returns the position or index of the first character of the filename given a full name A full name consists of a path and a filename Ex. FileNamePosition C Testing Test.txt 11 Function FileNamePosition sFullName As String As Integer Dim bFound As Boolean Dim nPosition As Integer bFound False nPosition Len sFullName Do While bFound False Make sure we were not dealt a zero-length string If nPosition 0 Then Exit Do We are looking for the first from the right. If Mid sFullName nPosition 1 Then bFound True Else Working right to left nPosition nPosition - 1 End If Loop If bFound False Then FileNamePosition 0 Else FileNamePosition nPosition End If End Function In addition to providing you with a useful way to isolate path- and filename components from a full filename Listing 5.8 includes one brand new concept which may not be apparent at first glance output parameters. Take a look at the declaration of the BreakdownName subroutine. Sub BreakdownName sFullName As String _ ByRef sName As String _ ByRef sPath As String 104 chapter 5 exploring the application object See the ByRef keyword in this declaration This keyword indicates that when if the BreakdownName function modifies these parameters the procedure that called BreakdownName will see the changes made to the variables. Listing 5.8 uses a simple procedure to test the BreakdownName procedure. You simply use the Get-SaveAsFilename method to obtain a full filename and pass the filename to the BreakdownName procedure along with two empty variables sName and sPath. BreakdownName uses the FileNamePosition function to locate the beginning of the filename component. Once you know that it is simple to break the name down into the path- and filename components using the VBA Left and Right functions. Both Left and Right take a string variable and return the specified number of characters from either .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.