Importing semi-colon separated file to an excel workbook

killpaddy

Board Regular
Joined
Jul 31, 2012
Messages
52
Hello,

Im very new to using the Visual-Basic Editor in Excel, I have been searching for a solution to my problem but could not find one.

Ive got a file .skv type (semi-colon separated) that ive set to open with excel (I'm using 2000). I want the data from this file (5000 rows with 4 semi-colon separated fields each, starting at cell A1) to be copied to A2 of an excel workbook ('VERTICAL STORAGE STOCK.xls', where the code is written) and then expanded into 4 columns.

In summary:
1. Open the .skv file (preferably in the background)
2. Copy the data from it
3. Paste it into the excel document where the code is running
4. Expand the data into the separate fields
5. Close the .skv file
(6. In the future this list may expand to more than 5000 rows)

Ive tried different tecniques from forums and this seems to be the closest code ive got so far:

Code:
Sub ImportWMS()

  Workbooks.Open filename:="E:\WMS.skv"

  ThisWorkbook.Worksheets(1).Range("A2:D5001").Value = _
  Workbooks("WMS.skv").Worksheets(1).Range("A1:D5000").Value

  ThisWorkbook.Worksheets(1).Range("A1:A5000").Values.Select
  Selection.TextToColumns DataType:=xlDelimited, ConsecutiveDelimiter:=False, Semicolon:=True
 
  Close False, "WMS.skv", False
 
  End Sub

Currently I'm getting the error message at line 8 - 'object doesnt support this property or method'

The data is copying in fine, but it is not being separated.
I'm quite sure the 'Close' line wont work either

The code is currently in 'Module 1' of 'VERTICAL STORAGE STOCK.xls'; Is this the right place?

If anyone has any suggestions can they be explained so i can understand them and use them again.

Thanks in advance for any help,

Killpaddy
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,216,076
Messages
6,128,670
Members
449,463
Latest member
Jojomen56

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top