Monthly Archives: March 2012

Output text files in Excel VBA

Sub LogInformation()
Const LogFileName As String = “D:\TEXTFILE.TXT”
Dim LogMessage As String
LogMessage = “123”
Dim FileNum As Integer
FileNum = FreeFile ‘ next file number
Open LogFileName For Output As #FileNum ‘ creates the file if it doesn’t exist
Print #FileNum, LogMessage ‘ write information at the end of the text file
Close #FileNum ‘ close the file
End Sub

Advertisements

PCL Zip temp files location

define(‘PCLZIP_TEMPORARY_DIR’, ‘/usr/www/temp/’);

http://www.phpconcept.net/pclzip

Automate Excel faster

Turn off Screen Updating

Application.ScreenUpdating = False
at the end:
Application.ScreenUpdating = True

Turn On Manual calculation

Sub GoToManual()

Dim xlCalc As XlCalculation

xlCalc = Application.Calculation

Application.Calculation = xlCalculationManual

On Error GoTo CalcBack

‘YOUR CODE

Application.Calculation = xlCalc

Exit Sub

CalcBack:

Application.Calculation = xlCalc

End Sub