Pasting while in edit mode

F

Finnegan

I am trying to create a macro that will take a 3270 screen scrape and paste
it into an Excel cell. Using ^A/^C in 3270 app /F2/^V in Excel manually
works every time.

The following code does not work in VS2005:

' Enable the shortcut keys:
Xl.OnKey("^c")
Xl.OnKey("^v")
Xl.OnKey("^x")
Xl.CommandBars("Cell").Enabled = True
Xl.CutCopyMode = True

'Take Screen Shot
Dim ScreenShot As Object = Sess0.Screen.Area(1, 1, 24, 80, 1, 3)
Dim SS As String = ScreenShot.ToString
ScreenShot.select()
Sess0.Screen.copy()

Xl.Worksheets(1).Range("A24").select()
Xl.ActiveCell.Cells(3, 3).select()
Xl.SendKeys("{F2}")
Xl.SendKeys("{^V}")
Xl.SendKeys("{Enter}")



It will copy to the clipboard, but will not ^V to paste into the cell.

Error:
System.Runtime.InteropServices.COMException was unhandled
ErrorCode = -2146827284
Message = "Exception from HRESULT: 0x800A03EC"
Source = "Interop.Excel"


This seems like a straightforward copy/cut/paste macro that is turning into
a nightmare. Do I not have something else Enabled? Can I do it from the
clipboard?

Please help!
 

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