Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem in PasteSpecial function


I everyone this is my first port in this forum
I m facing a weird problem
I have following code written in VBA

Dim Source As Range
Target.*Copy*
Set Source = Application.Worksheets("Sheet2").Range("$A$1,$A$3" )
Source.*PasteSpecial* xlPasteAll, xlPasteSpecialOperationNone
Target.Select

This works perfectly fine

And when i write the same code in VC++ (Excel com addin)
paste special just throws me into catch block
More if my rangeptr contains more than one cell then it says ki merge
cell should of equal size ?? (None of my cells are merged in tha
range

--
ojas_mar
-----------------------------------------------------------------------
ojas_maru's Profile: http://www.msusenet.com/member.php?userid=184
View this thread: http://www.msusenet.com/t-187050837

  #2   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default Problem in PasteSpecial function

Hi,

This probably doesn't answer your question, but I guess your VBA code can be
shortened dramatically:

1) If you want just values:

Private Sub Worksheet_Change(ByVal Target As Range)
Sheets("Sheet2").Range("$A$1,$A$3") = Target
End Sub

2) If you want to paste all:

Private Sub Worksheet_Change(ByVal Target As Range)
Target.Copy Sheets("Sheet2").Range("$A$1,$A$3")
End Sub

Reagards,
KL


"ojas_maru" wrote in message
...

I everyone this is my first port in this forum
I m facing a weird problem
I have following code written in VBA

Dim Source As Range
Target.*Copy*
Set Source = Application.Worksheets("Sheet2").Range("$A$1,$A$3" )
Source.*PasteSpecial* xlPasteAll, xlPasteSpecialOperationNone
Target.Select

This works perfectly fine

And when i write the same code in VC++ (Excel com addin)
paste special just throws me into catch block
More if my rangeptr contains more than one cell then it says ki merged
cell should of equal size ?? (None of my cells are merged in that
range)


--
ojas_maru
------------------------------------------------------------------------
ojas_maru's Profile: http://www.msusenet.com/member.php?userid=1849
View this thread: http://www.msusenet.com/t-1870508372



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem in PasteSpecial function


Well my aim is get it working in VC++
I dont know why pastespecial throws me in catch block.
I tried even the following statments.


pSourcePtr-GetApplication()-PutCutCopyMode(0, xlCopy);

I guess i need to set some parameter before calling paste special

--
ojas_mar
-----------------------------------------------------------------------
ojas_maru's Profile: http://www.msusenet.com/member.php?userid=184
View this thread: http://www.msusenet.com/t-187050837

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with speed of PasteSpecial for large ranges xlb[_2_] Excel Programming 4 February 20th 05 12:18 PM
selection.pastespecial problem rleonard[_2_] Excel Programming 1 May 31st 04 10:56 AM
FindNext problem when using PasteSpecial Glyn Baker Excel Programming 1 December 6th 03 08:40 PM
PasteSpecial problem Dave Peterson[_3_] Excel Programming 2 November 6th 03 02:45 AM
PasteSpecial problem Jim Rech Excel Programming 0 November 4th 03 04:47 PM


All times are GMT +1. The time now is 12:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"