I have an app which exports data to Excel. In excel the data is added, but with an square. This makes the calculations in Excel impossible.
I've tried to use the replace in text changed, but with no luck.
The code that export Listbox lines to Excel:
ListBox1_TextChanged:Code:Dim trace As Integer For trace = 1 To ListBox1.Items.Count xlWorkSheet.Cells(trace + 18, 2).Value = ListBox1.Items(trace - 1) Next
Code:ListBox1.Text = Replace(ListBox1.Text, Chr(8), String.Empty) 'backspace ListBox1.Text = Replace(ListBox1.Text, Chr(9), String.Empty) ' tab ListBox1.Text = Replace(ListBox1.Text, Chr(10), String.Empty) 'LF ListBox1.Text = Replace(ListBox1.Text, Chr(11), String.Empty) 'vertical tab ListBox1.Text = Replace(ListBox1.Text, Chr(12), String.Empty) 'form feed, new page ListBox1.Text = Replace(ListBox1.Text, Chr(13), String.Empty) 'CR ListBox1.Text = Replace(ListBox1.Text, Chr(32), String.Empty) 'Space ListBox1.Text = Replace(ListBox1.Text, Chr(35), String.Empty) ListBox1.Text = Replace(ListBox1.Text, Chr(127), String.Empty) ListBox1.Text = Replace(ListBox1.Text, Chr(129), String.Empty) ListBox1.Text = Replace(ListBox1.Text, Chr(141), String.Empty) ListBox1.Text = Replace(ListBox1.Text, Chr(143), String.Empty) ListBox1.Text = Replace(ListBox1.Text, Chr(144), String.Empty) ListBox1.Text = Replace(ListBox1.Text, Chr(157), String.Empty) ListBox1.Text = Replace(ListBox1.Text, Chr(249), String.Empty) ListBox1.Text = Replace(ListBox1.Text, Chr(254), String.Empty) 'Black box ListBox1.Text = Replace(ListBox1.Text, Chr(255), String.Empty) 'White Space




Reply With Quote