ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pasting while in edit mode (https://www.excelbanter.com/excel-programming/404484-pasting-while-edit-mode.html)

Finnegan

Pasting while in edit mode
 
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!


All times are GMT +1. The time now is 11:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com