473,397 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Importing .csv Files Into Excel

hi all,

kindly suggest me how to import .csv files into excel by using VB 6.0 SOFTWARE.Kindly help me asap.

Regards
Anup
May 4 '07 #1
8 10957
hi all,

kindly suggest me how to import .csv files into excel by using VB 6.0 SOFTWARE.Kindly help me asap.

Regards
Anup
Hi all,

Plzzzzzzzzzzzzzz help its very important and urgent..I tried the same by runing a macro and it had worked....But i cant figure out the same in vb6.0
May 4 '07 #2
SammyB
807 Expert 512MB
hi all,

kindly suggest me how to import .csv files into excel by using VB 6.0 SOFTWARE.Kindly help me asap.

Regards
Anup
I don't have VB6 here, so this is pretty much from memory.
First set a reference to Microsoft Excel Object Library
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Sub BtnExcel_Click()
  3.     Dim xlApp As New Excel.Application
  4.     Dim xlBook As Excel.Workbook
  5.     Set xlBook = xlApp.Workbooks.Open("C:\Documents and Settings\Sam\My Documents\IncomeSurvey.csv")
  6.     xlApp.Visible = True
  7. End Sub
HTH --Sam
May 5 '07 #3
I don't have VB6 here, so this is pretty much from memory.
First set a reference to Microsoft Excel Object Library
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Sub BtnExcel_Click()
  3.     Dim xlApp As New Excel.Application
  4.     Dim xlBook As Excel.Workbook
  5.     Set xlBook = xlApp.Workbooks.Open("C:\Documents and Settings\Sam\My Documents\IncomeSurvey.csv")
  6.     xlApp.Visible = True
  7. End Sub
HTH --Sam
Hi Sam.,

Above thing works when i do it in excel.....But it doesnot work when i do same thing in Vb6.
May 5 '07 #4
SammyB
807 Expert 512MB
Hi Sam.,

Above thing works when i do it in excel.....But it doesnot work when i do same thing in Vb6.
What fails? Did you add a reference to Microsoft Excel Objects?
May 5 '07 #5
What fails? Did you add a reference to Microsoft Excel Objects?
ya sam its working now.....I didnot add a reference in earlier occasion....Thanx for your support.
But there is one more problem now.When I ran this query it gives me entire detials in a single sales...

I want to imported these data by delimiting semilcon.So, that i can be able to see the contents in various columns.

Plz help
May 5 '07 #6
SammyB
807 Expert 512MB
I'm not sure I followed that, but if you mean that your file is semicolon deliminated instead of comma deliminated, then you just need to parse the data after opening:
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Sub BtnExcel_Click()
  3.     Dim xlApp As New Excel.Application
  4.     Dim xlBook As Excel.Workbook
  5.     Set xlBook = xlApp.Workbooks.Open("C:\Documents and Settings\Sam\My Documents\IncomeSurvey.csv")
  6.     xlApp.Visible = True
  7.     xlBook.ActiveSheet.Columns(1).TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
  8.         TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
  9.         Semicolon:=True, Comma:=False, Space:=False, Other:=False
  10. End Sub
May 5 '07 #7
I'm not sure I followed that, but if you mean that your file is semicolon deliminated instead of comma deliminated, then you just need to parse the data after opening:
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Sub BtnExcel_Click()
  3.     Dim xlApp As New Excel.Application
  4.     Dim xlBook As Excel.Workbook
  5.     Set xlBook = xlApp.Workbooks.Open("C:\Documents and Settings\Sam\My Documents\IncomeSurvey.csv")
  6.     xlApp.Visible = True
  7.     xlBook.ActiveSheet.Columns(1).TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
  8.         TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
  9.         Semicolon:=True, Comma:=False, Space:=False, Other:=False
  10. End Sub



hey there! Could you please help me out... I'm trying to open a database of access to an excel document through visual basic 6.0 any ideas? thanks a lot
Jun 8 '07 #8
Hi All,

I want to import A tsv file to a existing excel sheet instead of a new sheet. Kindly Help.

Thanks
Jun 19 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Grim Reaper | last post by:
I am importing a .csv file into Access that has 37 fields. My problem is that sometimes the last field only has data at the end of the column (it looks like when you import a file into Access, for...
1
by: Geoff Jones | last post by:
Hi I have a question which I hope somebody can answer. I have written a VB application with which I want to import an Excel file, analyze the data within it and do some calculations. There are...
2
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to...
5
by: hharriel | last post by:
Hi, I am hoping someone can help me with an issue I am having with excel and ms access. I have collected data (which are in individual excel files) from 49 different school districts. All...
3
by: mukeshsrivastav | last post by:
dear sir i want to move form excel to access. i have 5 excel file having same formats and fields.now i want to import all data in one access table. importing one file is easy .but importing and...
5
by: 14276674 | last post by:
I wrote a program in C that implemens a database. Now I want to upgrade the program so the user can import an excel worksheet and not have to fill in the entire database. How do you import data...
28
by: kkadakia | last post by:
I get a daily excel file for a entire month which I want to transfer into Access at the end of the month. So, there are around 20-25 excel files I get by the end of the month, and I would like to...
1
by: John Overton | last post by:
I have a new requirement to Import and Export Excel tables into and out of Access 2003. The Excel tables are located on a remote server but I know the path to the Excel Files. Can you please help...
1
by: thadson | last post by:
Hi, I'm trying to import specific cells from MS Excel 2000 spreadsheets to MS Access 2000 tables then move the spreadsheets to a different directory. I'm very new to this and I'm having trouble...
3
by: scoots987 | last post by:
What do others do if you need to import excel files into SQL Server? My main problems are 1) zipcode formatting issues. If the column is a mix of zip and zip+4, I have problems retrieving all...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.