Posted on 2004-05-13, 20:19, by OPE, under
File Access.
If the file type you want to open is supported by your default web browser, you can open the file like this: Sub BrowsePDFDocument() ‘ opens a PDF document in the default web browser Dim strDocument As String strDocument = "PDF Files,*.pdf,All Files,*.*" ‘ file type options ‘ get pdf document name strDocument = Application.GetOpenFilename(strDocument, [...]
Posted on 2000-11-02, 23:36, by OPE, under
File Access.
This workbook contains example macros that update log files every time the workbook is opened and closed. Click here to download this file. Updated: 2000-11-02 Requires: XL97 File size: 19 kB
Posted on 2000-11-02, 12:48, by OPE, under
File Access.
Log files are useful in different situations, specially for developers. Log files are plain text files that can store information temporary or more permanent. You don’t need much code to create a log file: Sub LogInformation(LogMessage As String) Const LogFileName As String = "C:\Foldername\Textfile.log" Dim FileNum As Integer FileNum = FreeFile ‘ next file number [...]
Posted on 1999-12-17, 12:48, by OPE, under
File Access.
Sequential access (Input, Output, and Append) is used for writing and reading text files, such as error logs and reports, e.g. *.txt files, *.ini files and *.csv files. Sequential access files are easy to create and manipulate with text editors, most applications can read and write files created with sequential access, and they are easy [...]
Posted on 1999-12-17, 12:48, by OPE, under
File Access.
A random access file is assumed to contain a series of records of equal length. This makes it easy and quick to locate stored information. Random access files can use less diskspace compared to sequential files. They can also waste space if fields in the records are left blank or if most of the record [...]
Posted on 1999-12-17, 12:48, by OPE, under
File Access.
The macros below can be used to replace text in a text file, e.g. when you want to change a column separator in a text file before you import it into an Excel worksheet or after you export a worksheet to a text file. Sub ReplaceTextInFile(SourceFile As String, sText As String, rText As String) Dim [...]
Posted on 1999-12-17, 12:48, by OPE, under
File Access.
Visual Basic for Applications provides functions for performing file input/output (I/O). This lets your custom solutions create, edit and store large amounts of data. You can also access several datasets at the same time and share data with other applications. There are three types of file access in VBA: Sequential, used with textfiles Random Access, [...]
Posted on 1999-12-17, 12:48, by OPE, under
File Access.
With binary access it’s possible to store information in any way you want, you are not limitied to a fixed record length. This means that you have to know how the information is stored in a binary file to retrieve it again. Binary access files uses less diskspace by allowing variable sized records. You can [...]
Posted on 1999-12-17, 12:48, by OPE, under
File Access.
It is possible to use the Microsoft Scripting Runtime library to manipulate text files. Microsoft Scripting Runtime is included in these products: Windows98, Windows2000, IE5, and Office2000. The macro examples below assumes that your VBA project has added a reference to the Microsoft Scripting Runtime library. You can do this from within the VBE by [...]