.NET walkabout
posts - 11, comments - 18, trackbacks - 0

Visual Basic

The good old Visual Basic
Editare file di Excel 2007 da VBA o VB6

Interessante articolo su come editare il formato OPENXML di Excel 2007 utilizzando il buon vecchio VBA o, per estensione, il sempre valido Visual basic 6.

posted @ Friday, May 8, 2009 9:44 AM | Feedback (1) | Filed Under [ Visual Basic VBA VBA ]

How to zip a file using Visual Basic 6 and the Windows Shell

When it was a matter of zipping a file, I always choosed the easy way: find a thirdy part activex or dll which could do the job for me. This time, I wanted to find my way to zip a file using Visual Basic 6 (or Visual Basic for Application - aka VBA) and the windows shell. The consderation came from the fact that, since Windows XP,  the support of zipping-unizzping files is a native feature of the OS. After a long search and multiple fixes, I finally came up with a stable solution which I'm going to quickly explain and post...

posted @ Friday, March 27, 2009 11:40 AM | Feedback (0) | Filed Under [ Visual Basic VBA ]

OLEDB and text files

This is a very quick example about OLEDB and read a text (.txt) file using Visual Basic 6. The text file must be formatted as a simple CSV file with a field separator. Something like this Test.txt a;1;Test b;2;Test c;3;Test d;4;Test Supposing "Test.Txt" is stored in the root of the C: harddrive, the code will look like ---------------------------------------- Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Set cn = CreateObject("ADODB.Connection") cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\;Extended Properties=""text;HDR=No;FMT=Delimited'""" Set rs = CreateObject("ADODB.Recordset") rs.Open "SELECT * FROM Test.txt", cn, 0, 1, 1 While Not rs.EOF     Debug.Print rs.Fields(0).Value, rs.Fields(1).Value, rs.Fields(2).Value     rs.MoveNext Wend rs.Close Set rs = Nothing cn.Close Set cn = Nothing ---------------------------------------- Take a look to the connection string "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\;Extended Properties=""text;HDR=No;FMT=Delimited'""" the Data Source=c:\; is the key. If you...

posted @ Sunday, October 7, 2007 8:00 PM | Feedback (0) | Filed Under [ Visual Basic OLEDB ]

Powered by:
Powered By Subtext Powered By ASP.NET