Hi,
I am using the below code to create the text box based on cell data.
But now I want this text box to automatically size with the text length and width.
Code
Sub Current_Click()
'Support to text'
Const DELIMITER = " "
Dim myFile As String
Dim rng As Range
Dim cellValue As Variant
Dim i As Integer
Dim j As Integer
Dim sngRow As Range
Dim vDat As Variant
With Worksheets("Panel")
Set rng = .Range("R36:S45")
End With
Dim noCol As Long
noCol = rng.Columns.Count
Open "E:\Current.txt" For Output As #1
For Each sngRow In rng.Rows
vDat = WorksheetFunction.Transpose(WorksheetFunction.Transpose(sngRow))
vDat = Join(vDat, DELIMITER)
If Len(vDat) >= noCol Then
Print #1, vDat
End If
Next
Close #1
'open text file'
Dim fso As Object
Dim sfile As String
Set fso = CreateObject("shell.application")
sfile = "E:\Current.txt"
fso.Open (sfile)
End Sub
Display More
Can It be possible to do it by using VBA?
Thanks in Advance.