Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
Hi all,
i have a large data set ( which has around 400 columns and 200 rows). this is the output of an instrument exported as a dat file. i am not able able to open with excel (as it is too big). however i need only selected columns(only 12 and they are always the same columns that are needed) from the data set. can anyone tell me how i can get these columns from the .dat files using VB6. Thanks a lot in advance Anu |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
Do you have Office 2007?
400 columns is way beyond capacities of Excel 2003! -- AP "anu" a écrit dans le message de news: ... Hi all, i have a large data set ( which has around 400 columns and 200 rows). this is the output of an instrument exported as a dat file. i am not able able to open with excel (as it is too big). however i need only selected columns(only 12 and they are always the same columns that are needed) from the data set. can anyone tell me how i can get these columns from the .dat files using VB6. Thanks a lot in advance Anu |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
hi AP,
i have only windows XP. it is just that the instrument can spit out so much of data. i can only open it as a text file. is there any way i can selct specific columns from .dat file without changing it into excel? Thanks Anu |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
If the dat file is fixed lengths for each column, or is delimited you can
work with the file easily with VBA. E.g. Open the file then read each row and parse the values you want. Dim fn As Long Dim LineOfText As String fn = FreeFile() Open "c:\myfile.dat" For Input As #fn While Not EOF(fn) Line Input #fn, LineOfText ' ### work with line code ### Wend Close #fn -- Tony Green "anu" wrote: hi AP, i have only windows XP. it is just that the instrument can spit out so much of data. i can only open it as a text file. is there any way i can selct specific columns from .dat file without changing it into excel? Thanks Anu |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
Anu
Is it a CSVfile? If so, you could read it with ADO. Public Sub GetData() Dim oConn As Object Dim oRS As Object Dim sFilename As String Dim sConnect As String Dim sSQL As String sFilename = "C:\MyTest\" sConnect = "Driver={Microsoft Text Driver (*.txt; *.csv)};" & _ "Dbq=" & sFilename & ";" & _ "Extensions=asc,csv,tab,txt;" sSQL = "SELECT First,Last From ADOTest.csv" Set oRS = CreateObject("ADODB.Recordset") oRS.Open sSQL, sConnect, adOpenForwardOnly, _ adLockReadOnly, adCmdText If Not oRS.EOF Then ActiveSheet.Range("A1").CopyFromRecordset oRS Else MsgBox "No records returned.", vbCritical End If oRS.Close Set oRS = Nothing End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "anu" wrote in message ups.com... hi AP, i have only windows XP. it is just that the instrument can spit out so much of data. i can only open it as a text file. is there any way i can selct specific columns from .dat file without changing it into excel? Thanks Anu |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
"Bob Phillips" wrote:
Is it a CSVfile? If so, you could read it with ADO. I've been under the impression that the Excel Text Driver ( and the JET 4.0 provider) would not cope with more than 256 columns/fields in the data source irrespective of the number selected. I'll try it out. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
Hi All, it is not a CSV file. :-( wat shall i do? Thanks Anu |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
Hi Anu
If you open the file in notepad, what separates the data fields ? Is it a tab between the data, some symbol, or what ? Best wishes Harald "anu" skrev i melding ups.com... Hi all, i have a large data set ( which has around 400 columns and 200 rows). this is the output of an instrument exported as a dat file. i am not able able to open with excel (as it is too big). however i need only selected columns(only 12 and they are always the same columns that are needed) from the data set. can anyone tell me how i can get these columns from the .dat files using VB6. Thanks a lot in advance Anu |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
Hi, When i open the data in notepad all the values are separated by tab. does it help? Thanks Anu |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
Hi Anu
It sure does. Here is code (VB6 and VBA) to prompt fields 9 and 13 record by record. Change filename to fit. I'm sure you can modify it from he Sub Read() Dim S As String Dim SS() As String Open "C:\Temp\Test.dat" For Input As #1 While Not EOF(1) Line Input #1, S SS = Split(S, vbTab) MsgBox "Values are " & SS(9) & " and " & SS(13) Wend Close #1 End Sub HTH. Best wishes Harald "anu" skrev i melding oups.com... Hi, When i open the data in notepad all the values are separated by tab. does it help? Thanks Anu |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
You may be correct, but the SQL only reads two columns as per the OP
request. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "AA2e72E" wrote in message ... "Bob Phillips" wrote: Is it a CSVfile? If so, you could read it with ADO. I've been under the impression that the Excel Text Driver ( and the JET 4.0 provider) would not cope with more than 256 columns/fields in the data source irrespective of the number selected. I'll try it out. |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
What sort of file is it?
-- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "anu" wrote in message ups.com... Hi All, it is not a CSV file. :-( wat shall i do? Thanks Anu |
#13
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
it is a .dat file ....Anu |
#14
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
Hi Harald, thanks for ur help. will try it and see. Anu |
#15
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
I meant the format Anu, not the file extension. Anyway, Harald's suggestion
might be your solution, post back if not. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "anu" wrote in message oups.com... it is a .dat file ...Anu |
#16
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
Hi Harald, Thanks for your help. It does work.however, i want to save all the selected columns in a table so that i can query and get every record. is it possible in Vb6? I havent done much of programming so please do help me. Thanks Anu |
#17
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
Hi again Anu
It is definitely possible. But you ask me to teach you VB6 in a short newsgroup posting. The good VB books are 800+ pages thick, there are many of them and there are good reasons for both. You have to be far more specific. Or get a thick book. Or hire a pro to do the job, it isn't complicated (if I understand you right that is). Best wishes Harald "anu" skrev i melding ups.com... Hi Harald, Thanks for your help. It does work.however, i want to save all the selected columns in a table so that i can query and get every record. is it possible in Vb6? I havent done much of programming so please do help me. Thanks Anu |
#18
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help in VB6
Perhaps you need to follow the advice to hire a professional.
-- Don Guillett SalesAid Software "anu" wrote in message ups.com... Hi Harald, Thanks for your help. It does work.however, i want to save all the selected columns in a table so that i can query and get every record. is it possible in Vb6? I havent done much of programming so please do help me. Thanks Anu |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|