LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Get macro to copy one row from excel to a text file. Possible?

Bjorn,

Sorry, sloppy copy and paste work. That last parameter should read:

OtherChar:="*"

Note the ending double quote mark.

HTH,
Bernie
MS Excel MVP


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message news:...
Bjorn,

Workbooks.OpenText _
Filename:=Application.GetOpenFilename, _
DataType:=xlDelimited, _
ConsecutiveDelimiter:=False, _
Comma:=False, Other:=True, OtherChar:="*

HTH,
Bernie
MS Excel MVP


"bjorn007" wrote in message
...

Hello!
Thanks for the help. It worked really good, but I have a small question
more.
I can not use Comma (,) as the delimiter (because some of the data that
will be copied into the text file contains comma). So I change it to *.
So far so good!
But when I would like to upload, I get some problems when the data
contains commas. Everything get misplaced. I tried to change
Comma:=True to for example Star:=True or SemiColumn:=True, but it
doesn't work. Do you have any suggestions how to fix it?

And I am really thankful for your help, I would never managed this by
myself. THANK YOU!

Bjorn

Here's the code:

Code 1
myName = ActiveWorkbook.FullName
FName = Application.GetSaveAsFilename( _
Replace(myName, ".xls", ".txt"))
On Error GoTo EndMacro:
FNum = FreeFile
Open FName For Output Access Write As #FNum
Set myRange = Worksheets("database").Range("A6:CL6")
WholeLine = ""
For Each myCell In myRange
WholeLine = WholeLine & myCell.Text & "* " 'Changed to *
Next myCell

WholeLine = Left(WholeLine, Len(WholeLine) - 1)

Print #FNum, Trim(WholeLine)


Code 2
Dim myBook As Workbook
Workbooks.OpenText _
Filename:=Application.GetOpenFilename, _
DataType:=xlDelimited, _
ConsecutiveDelimiter:=False, _
*Comma*:=True ''Here's my problem!!!
Set myBook = ActiveWorkbook
Range("A1").CurrentRegion.Copy
ThisWorkbook.Worksheets("Database").Range("A6").Pa steSpecial _
Paste:=xlPasteValues
myBook.Close False


--
bjorn007
------------------------------------------------------------------------
bjorn007's Profile: http://www.excelforum.com/member.php...o&userid=25959
View this thread: http://www.excelforum.com/showthread...hreadid=393281





 
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
Get macro to copy one row from excel to a text file. Possible? bjorn007 Excel Programming 9 August 11th 05 04:56 PM
VBA Macro to copy an column from one Excel file into another file Sam Excel Programming 4 July 3rd 05 03:36 AM
How do I copy a Word text file into Excel in a way that each char. Newtech programmer Excel Discussion (Misc queries) 2 April 15th 05 07:07 PM
copy Excel worksheets into one text file Helge Arntsen Excel Programming 3 September 24th 04 09:06 AM
Macro to copy daily text file Cheryl[_4_] Excel Programming 1 May 27th 04 05:46 AM


All times are GMT +1. The time now is 08:17 AM.

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"