VBA - Read from clipboard fails
Experimenting with other ways to transfer data from Excel to R using BERT, I thought I'd try reading a table off the clipboard. The following works fine when run directly in the BERT console:
cliptable <- read.table("clipboard",sep="\t",header=TRUE)
However, when I run this same command in Excel from VBA using
Application.Run "BERT.Exec", "cliptable <- read.table(""clipboard"",sep=""\t"",header=TRUE)"
Excel briefly locks up, then the BERT console spits out the error
Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : clipboard cannot be opened or contains no text
What is happening in BERT where the same command passed through COM fails? Unfortunately, not much on the web to shed light on this error. This is being run in Windows 10 Pro (64-bit) and Excel 2016 (64-bit).