I have a simple VB script that I use in Excel that copies selected cell values to the clipboard as a delimited list:
It prompts for a delimiter and an encloser character to use.
I would like to convert this VB to JS so as to be able to use in UEStudio. Does anyone have or know of a VB to JS statement cross reference I could reference?
Thanks in advance.
Code: Select all
Sub CopyToDelimited()
Dim rRange As Range
Dim rCount As Integer
Dim pCount As Integer
Dim sQuery As String
Dim strDelimit As String
Dim strEnclose As String
Dim objDataObj As DataObject
Set objDataObj = New DataObject
On Error GoTo Fail
strDelimit = InputBox(Prompt:="Enter character(s) to use as delimiter between each field", _
Title:="Delimiter selection -- defaults to a comma", _
Default:=",")
strEnclose = InputBox(Prompt:="Enter character(s) to enclose each field with", _
Title:="Enclosure character(s) selection -- defaults to nothing", _
Default:="")
Selection.SpecialCells(xlCellTypeVisible).Select
rCount = Selection.Count
pCount = 1
For Each rRange In Selection
If rRange.Text <> "" Then
If sQuery <> "" Then
sQuery = sQuery & strEnclose & rRange.Text
Else
sQuery = strEnclose & rRange.Text
End If
If rCount = pCount Then
sQuery = sQuery & strEnclose
Else
sQuery = sQuery & strEnclose & strDelimit
End If
End If
pCount = pCount + 1
Next
objDataObj.SetText sQuery, 1
objDataObj.PutInClipboard
Fail:
Set objDataObj = Nothing
End Sub
I would like to convert this VB to JS so as to be able to use in UEStudio. Does anyone have or know of a VB to JS statement cross reference I could reference?
Thanks in advance.