PDA

View Full Version : Special Characters



mikke3141
12-23-2014, 04:42 AM
Hello,

I'm trying to load the attached text file to excel, but the special character (c in the word Baco) creates a line break. What to do?



Sub loadit()Dim i As Integer
Dim pos As Integer
Dim ffile As String
Dim ffile2 As String


se = "C:\Users\" & Environ("USERNAME") & "\Desktop"
ffile = se & "\source.csv" 'your source file
ffile2 = se & "\ready.xls" 'your destination file
Dim vstring As String
Dim a As Variant
Dim b As Integer
Open ffile For Input As #1
Open ffile2 For Output As #2
Do While Not (EOF(1))
Line Input #1, vstring
If Not (vstring = "") Then
vstring = Replace(vstring, vbTab, ";")
Write #2, vstring
End If
Loop


Close #1
Close #2


End Sub

snb
12-23-2014, 06:40 AM
use


Sub M_snb()
workbooks.open "C:\Users\" & Environ("USERNAME") & "\Desktop\source.csv"
End Sub

mikke3141
12-27-2014, 11:17 AM
This other attachment test.csv does not load correctly with workbooks.open

sktneer
12-28-2014, 09:56 AM
What do you mean by does not load correctly?
The below code will open your test.csv saved on desktop without an issue.
If problem is something else, please make it clear.


Sub mikke()
Workbooks.Open Environ("UserProfile") & "\Desktop\test.csv"
End Sub