https://issues.apache.org/ooo/show_bug.cgi?id=126076
Issue ID: 126076
Issue Type: DEFECT
Summary: TRIM and CLEAN Function not working in opencalc vba
macro
Product: Calc
Version: 3.4.0
Hardware: All
OS: Windows, all
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: code
Assignee: [email protected]
Reporter: [email protected]
Created attachment 84480
--> https://issues.apache.org/ooo/attachment.cgi?id=84480&action=edit
Output file
Hi,
I have written a vba macro on open calc.
How Macro Works
I will enter data in certain columns and when i click on the submit button
whatever the data in the open calc should be written to a text file.
But here comes the problem i dont have spaces in my cell values but when the
text file is generated iam getting leading and trailing spaces for each cell
value.
so i tried to used trim function to eliminate the leading and trailing spaces
but the trim function is not working.Instead i tried to use clean function as
well,even that too is not working.
Please find my macro code as below Attaching the output file as well.
Option VBASupport 1
Private Sub CommandButton1_Click()
Dim myFile As String, rng As Range, cellValue As String, i As Integer, j As
Integer
myFile = ThisWorkbook.Path & "\Upload_File.txt"
Open myFile For Output As #1
Set rng = Selection
For i = 1 To rng.Rows.Count
For j = 1 To rng.Columns.Count
cellValue = rng.Cells(i,j).Value
If j = rng.Columns.Count Then
Print #1 , Trim(cellValue)
Else
Print #1 , Trim(cellValue) ,
End If
Next j
Next i
Close #1
End Sub
--
You are receiving this mail because:
You are the assignee for the issue.
You are watching all issue changes.