Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
Can anybody help me write a macro to paste a string/number from Clipboard to QV variable.
Thanks
Abhishek
A little Internet research hints that vbscript can't access the clipboard directly.
A suggestion is to use an application (Excel?) to paste from the clipbaord.
Then store the value into the QlikView variable.
Thanks for the suggestion.
I am currently using excel only. But when I use excel , I need to perform a reload to get the results back to Qlikview.
Can we copy data from excel to a Qlikview variable using Macro?
Thanks in advance for the solution.
sub ClipboardToVariable
Set XLApp = CreateObject("Excel.Application")
XLApp.Visible = False
Set XLWorkbook = XLApp.Workbooks.Add
Set XLSheet1 = XLWorkbook.sheets("Sheet1")
XLSheet1.select
XLSheet1.Range("A1").select
on error resume next
XLSheet1.Paste
set v = ActiveDocument.Variables("vFromClipboard") 'Replace vFromClipboard with your QlikView variable name
v.SetContent XLSheet1.Range("A1").value,True
XLWorkbook.Close False
set XLSheet = nothing
set XLWorkbook = nothing
XLApp.Quit
set XLApp = nothing
set v = nothing
end sub