View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Willow[_4_] Willow[_4_] is offline
external usenet poster
 
Posts: 1
Default Opening csv in Word


Hi all

I have pasteSpecial / transposed a column into a row and saved as a cs
file. When this is opened in Word, it includes the empty column value
:-

test1;test2;test3;test4;test5;test6;test7;test8;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
and so on

The code I have used for the copy /paste special is:

' select and copy only the cells with numbers

ActiveSheet.Range(Cells(1, 1), Cells(j - 1, 1)).Select
ActiveSheet.Range(Cells(1, 1), Cells(j - 1, 1)).Copy
MsgBox ("Range Selected and copied")

' paste transpose into the second sheet in the workbook

Worksheets("Sheet2").Activate
ActiveSheet.Cells(1, 1).PasteSpecial Paste:=xlPasteValues
SkipBlanks:=True, Transpose:=True

MsgBox ("Transposed and pasted")

' Paste second sheet into new temporary workbook and save it as .cs
file and close new workbook

ActiveSheet.Copy


ActiveSheet.SaveAs Filename:="C:\Temp", FileFormat:=xlCSV

Workbooks("Temp").Activate
Worksheets("Temp").Activate
Workbooks("Temp").Close SaveChanges:=False

If this is done manually, the extra ::::: are not there.

Can anyone help - I am trying to get a CSV list onto the clipboard t
paste into another application....

Thanks


Li

--
Willo
-----------------------------------------------------------------------
Willow's Profile: http://www.excelforum.com/member.php...fo&userid=1607
View this thread: http://www.excelforum.com/showthread.php?threadid=27567