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