Placing text box value on Clipboard

S

Sarah

Help! I can't seem to get this part to work right. I have a form on
which the user enters a date range (From and To). I want to copy the
value in the From text box and paste it into a cell in MS Excel, but I
can't seem to get it onto the clipboard. I have tried the code below.

Dim appXL As Excel.Application
Dim dtFrom As Date

dtFrom.SetText Me.txtFromDt.Text
dtFrom.PutInClipboard
appXL.Range("B1").Select
ActiveSheet.PasteSpecial Format:="Text", Link:=False,
DisplayAsIcon:=False

I get a compilation error that I have an invalid qualifier. I know
this should be really simple, but I've tried every way I can think to
get this date into cell B1! If anyone can help, I would be eternally
grateful! ;-)

Sarah
sarah_kiko@(removethis)cinfin.com
 
J

JackD

Why bother with the clipboard?
Set the value of the cell to the value in the textbox.

appXL.Range("B1").value = whateverFormName.TextboxSomething.Text

-Jack
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top