By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,515 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,515 IT Pros & Developers. It's quick & easy.

Importing .csv Files Into Excel

P: 81
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
Share this Question
Share on Google+
8 Replies


P: 81
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
Expert 100+
P: 807
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

P: 81
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
Expert 100+
P: 807
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

P: 81
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
Expert 100+
P: 807
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

P: 14
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

P: 1
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

Post your reply

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