Excell cuts string when copying

  • Thread starter temp_for_oracle
  • Start date
T

temp_for_oracle

Hi All
I have problem with copy paste using VBA.

I have a worksheet and its filled with some data. There is also a
button that creates another worksheet ad copy some range to the new
worksheet

I am using the following code :

Dim objExcel As Excel.Application
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
objExcel.Visible = False
Worksheets("AD Request Form").Range("A1:W12").Copy
objExcel.Range("A1:W12").PasteSpecial (xlPasteValues)


The problem is that in some cells there is a lot of text.
After copy paste in the new worksheet all strings are being cut to 255
char

Is there some workarround
Plz help it is very important to me


BR,
Krzysztof
 
J

Jim Rech

Why are you creating another instance of Excel? Just use the current
instance and the text will not be truncated.

--
Jim
"temp_for_oracle"
message |
| Hi All
| I have problem with copy paste using VBA.
|
| I have a worksheet and its filled with some data. There is also a
| button that creates another worksheet ad copy some range to the new
| worksheet
|
| I am using the following code :
|
| Dim objExcel As Excel.Application
| Set objExcel = CreateObject("Excel.Application")
| objExcel.Workbooks.Add
| objExcel.Visible = False
| Worksheets("AD Request Form").Range("A1:W12").Copy
| objExcel.Range("A1:W12").PasteSpecial (xlPasteValues)
|
|
| The problem is that in some cells there is a lot of text.
| After copy paste in the new worksheet all strings are being cut to 255
| char
|
| Is there some workarround
| Plz help it is very important to me
|
|
| BR,
| Krzysztof
|
|
| --
| temp_for_oracle
| ------------------------------------------------------------------------
| temp_for_oracle's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=25912
| View this thread: http://www.excelforum.com/showthread.php?threadid=392881
|
 
I

ilyaskazi

Try this...


Code:
--------------------
Sub testRemove()

Worksheets("AD Request Form").Range("A1:W12").Copy

Workbooks.Add
wsNew.Range("A1").PasteSpecial
Cells.Calculate

End Sub
 

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