Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Opening csv in Word

Excel likes to put trailing delimiters based on the layout of the data. There's
a kb article that describes how this works, but I couldn't find it (and got
tired of looking!).

But maybe you could use a macro to write your text file yourself:

Here are three sites that you could steal some code from:

Earl Kiosterud's Text Write program:
www.smokeylake.com/excel
(or directly: http://www.smokeylake.com/excel/text_write_program.htm)

Chip Pearson's:
http://www.cpearson.com/excel/imptext.htm

J.E. McGimpsey's:
http://www.mcgimpsey.com/excel/textfiles.html

(You may be happy with Earl's version--right out of the box!)

Willow wrote:

Hi all

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

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 .csv
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 to
paste into another application....

Thanks

Liz

--
Willow
------------------------------------------------------------------------
Willow's Profile: http://www.excelforum.com/member.php...o&userid=16070
View this thread: http://www.excelforum.com/showthread...hreadid=275674


--

Dave Peterson

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
opening word document rk0909 Excel Discussion (Misc queries) 0 January 10th 07 02:42 PM
Hyperlink to rtf only opening in MS Word Ben J Excel Discussion (Misc queries) 0 September 30th 05 06:02 PM
Opening a csv file in word saybut Excel Discussion (Misc queries) 1 September 19th 05 06:15 PM
Excel-Opening Word AW Excel Programming 0 April 2nd 04 09:21 AM
Opening a Word doc and more Merv[_2_] Excel Programming 1 January 23rd 04 01:47 PM


All times are GMT +1. The time now is 09:49 PM.

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

About Us

"It's about Microsoft Excel"