W
Wild Bill
Posted to microsoft.public.excel, microsoft.public.excel.programming
Copy from windows clipboard in VBA
Thank you each for even your time reading this whether or not you reply.
It was hard to shorten this. I want to paste [Notepad] text to a single
cell. I've resigned myself to Ctrl-A, Ctrl-C in Notepad - but want to
automate the rest. I'll be doing this many times.
(A)I've hit dead ends with .paste, .pastespecial as Excel seems to
disregard the "outside" clipboard.
I've experimented with two angles seeking whole VBA automation or
perhaps even a single keystroke+VBA.
(B)Straight Ctrl-V is complicated by embedded linefeeds. I wipe out
cells beneath the active cell. I can work around that with a dedicated
cell at the bottom of the sheet - or even a scratch worksheet. What
would be the command to copy the scratch cell? Something like
activecell.formulaR1C1=range("ScratchCell").value
or
activecell.value=range("ScratchCell").value
or some .Copy? Remember those deadly linefeeds!
(C)I can manually hit F2,Ctrl-V,Enter. This gets it done in one shot but
I can't imagine emulating it in VBA. Can VBA even at least cut down the
number of strokes?
So how should I paste multiline clipboard text from VBA - or at least
cut down the manual part?
P.S. I'm reticent to use SendKeys for the usual reasons - but I'll put
that thought out there too. From where I'm at now, it's a temptation.
Copy from windows clipboard in VBA
Thank you each for even your time reading this whether or not you reply.
It was hard to shorten this. I want to paste [Notepad] text to a single
cell. I've resigned myself to Ctrl-A, Ctrl-C in Notepad - but want to
automate the rest. I'll be doing this many times.
(A)I've hit dead ends with .paste, .pastespecial as Excel seems to
disregard the "outside" clipboard.
I've experimented with two angles seeking whole VBA automation or
perhaps even a single keystroke+VBA.
(B)Straight Ctrl-V is complicated by embedded linefeeds. I wipe out
cells beneath the active cell. I can work around that with a dedicated
cell at the bottom of the sheet - or even a scratch worksheet. What
would be the command to copy the scratch cell? Something like
activecell.formulaR1C1=range("ScratchCell").value
or
activecell.value=range("ScratchCell").value
or some .Copy? Remember those deadly linefeeds!
(C)I can manually hit F2,Ctrl-V,Enter. This gets it done in one shot but
I can't imagine emulating it in VBA. Can VBA even at least cut down the
number of strokes?
So how should I paste multiline clipboard text from VBA - or at least
cut down the manual part?
P.S. I'm reticent to use SendKeys for the usual reasons - but I'll put
that thought out there too. From where I'm at now, it's a temptation.