Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Need help by smart people!!!

I posted this yesterday, but noone replied. I'm hoping it's not because
there's no solution to my problem! Here's the deal...

I have a Cell in Excel which calls a VBA function which returns a long
string. The VBA function works correctly and the output looks correct in the
Cell. When I copy and paste that cell from Excel into Notepad, it adds
quotation marks around the beginning and end of the text. I can't figure out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is also a
long string but one which I typed directly into the cell and not from a VBA
function call - there are not quotation marks around the text in Notepad!

Very, very frustrating...any help would be most appreciated...

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Need help by smart people!!!

1. Open Notepad
2. Open Excel with a fresh, new, workbook
3. Enter the following UDF:

Function hello() As String
hello = "hello"
End Function

4. In cell A1 of any sheet enter:
=hello()

5. Select the cell; copy the cell; click in Notepad and paste

On my configuration (WinXP and Excel 2002), no quotes (single or double)
appear.

What is you configuration ?
--
Gary''s Student - gsnu200745


"rfusee" wrote:

I posted this yesterday, but noone replied. I'm hoping it's not because
there's no solution to my problem! Here's the deal...

I have a Cell in Excel which calls a VBA function which returns a long
string. The VBA function works correctly and the output looks correct in the
Cell. When I copy and paste that cell from Excel into Notepad, it adds
quotation marks around the beginning and end of the text. I can't figure out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is also a
long string but one which I typed directly into the cell and not from a VBA
function call - there are not quotation marks around the text in Notepad!

Very, very frustrating...any help would be most appreciated...

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Need help by smart people!!!

On Sep 19, 4:58 pm, rfusee wrote:
I posted this yesterday, but noone replied. I'm hoping it's not because
there's no solution to my problem! Here's the deal...

I have a Cell in Excel which calls a VBA function which returns a long
string. The VBA function works correctly and the output looks correct in the
Cell. When I copy and paste that cell from Excel into Notepad, it adds
quotation marks around the beginning and end of the text. I can't figure out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is also a
long string but one which I typed directly into the cell and not from a VBA
function call - there are not quotation marks around the text in Notepad!

Very, very frustrating...any help would be most appreciated...


It sounds like you're coping a formula from the first cell. That's
why you have the quotation marks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default Need help by smart people!!!

On Wed, 19 Sep 2007 13:58:04 -0700, rfusee
wrote:


I have a Cell in Excel which calls a VBA function which returns a long
string. The VBA function works correctly and the output looks correct in the
Cell. When I copy and paste that cell from Excel into Notepad, it adds
quotation marks around the beginning and end of the text. I can't figure out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is also a
long string but one which I typed directly into the cell and not from a VBA
function call - there are not quotation marks around the text in Notepad!

Very, very frustrating...any help would be most appreciated...


I can't reproduce with a 100 character string. Can you post the code your
using, or a simplified version that exhibits the same behavior?
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Need help by smart people!!!

I bet you have alt-enters in your cell to force new lines within the cell.

Maybe you can do the copying in your code:

I used the PutOnClipboard routine that Chip Pearson has:
http://www.cpearson.com/excel/clipboard.htm

With this sub:
Option Explicit
Sub testme()
PutOnClipboard ActiveCell.Text
End Sub

And then pasted (manually) into NotePad. No double quotes were inserted.

Chip has instructions that you have to follow (including the tools|references
with "Microsoft Forms 2.0 object library") on that sheet.



rfusee wrote:

I posted this yesterday, but noone replied. I'm hoping it's not because
there's no solution to my problem! Here's the deal...

I have a Cell in Excel which calls a VBA function which returns a long
string. The VBA function works correctly and the output looks correct in the
Cell. When I copy and paste that cell from Excel into Notepad, it adds
quotation marks around the beginning and end of the text. I can't figure out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is also a
long string but one which I typed directly into the cell and not from a VBA
function call - there are not quotation marks around the text in Notepad!

Very, very frustrating...any help would be most appreciated...


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Need help by smart people!!!

Moose,

There are a couple IF conditions that are met prior to the function being
called, is that what is causing this?

THANKS!!!!

"Moose" wrote:

On Sep 19, 4:58 pm, rfusee wrote:
I posted this yesterday, but noone replied. I'm hoping it's not because
there's no solution to my problem! Here's the deal...

I have a Cell in Excel which calls a VBA function which returns a long
string. The VBA function works correctly and the output looks correct in the
Cell. When I copy and paste that cell from Excel into Notepad, it adds
quotation marks around the beginning and end of the text. I can't figure out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is also a
long string but one which I typed directly into the cell and not from a VBA
function call - there are not quotation marks around the text in Notepad!

Very, very frustrating...any help would be most appreciated...


It sounds like you're coping a formula from the first cell. That's
why you have the quotation marks.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Need help by smart people!!!

Dave,

I use the "line1" & vbCrLf & "line2" .....etc to force new lines within the
cell. Is there a better way?

THANKS!!!!!

"Dave Peterson" wrote:

I bet you have alt-enters in your cell to force new lines within the cell.

Maybe you can do the copying in your code:

I used the PutOnClipboard routine that Chip Pearson has:
http://www.cpearson.com/excel/clipboard.htm

With this sub:
Option Explicit
Sub testme()
PutOnClipboard ActiveCell.Text
End Sub

And then pasted (manually) into NotePad. No double quotes were inserted.

Chip has instructions that you have to follow (including the tools|references
with "Microsoft Forms 2.0 object library") on that sheet.



rfusee wrote:

I posted this yesterday, but noone replied. I'm hoping it's not because
there's no solution to my problem! Here's the deal...

I have a Cell in Excel which calls a VBA function which returns a long
string. The VBA function works correctly and the output looks correct in the
Cell. When I copy and paste that cell from Excel into Notepad, it adds
quotation marks around the beginning and end of the text. I can't figure out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is also a
long string but one which I typed directly into the cell and not from a VBA
function call - there are not quotation marks around the text in Notepad!

Very, very frustrating...any help would be most appreciated...


--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Need help by smart people!!!

Sure, here is one of the functions that I call which does this
behavior...it's very simple stuff, but I am brand new to this so I could be
doing something stupid...


Function MRBJMS(ServNum As Integer, WorkNum As Integer, Storage As String)
As String

MRBJMS = "text text text text text" _
& "text text text text" _
& "text text text text" & vbCrLf & "1. " _
& ServNum & " Server and " & WorkNum & " license(s) to ....... " _
& "text text text" _
& "center." & vbCrLf & "2. " & Storage & " of combined backup storage
(compressed)." _
& vbCrLf & "3. more text." _
& vbCrLf & "4. more text." _
& vbCrLf & "5. more text." _
& vbCrLf & "6. more text. " _
& "more text." _
& vbCrLf & "7. more text." _
& vbCrLf & "8. more text." _
& vbCrLf & "9. more text."

"Dick Kusleika" wrote:

On Wed, 19 Sep 2007 13:58:04 -0700, rfusee
wrote:


I have a Cell in Excel which calls a VBA function which returns a long
string. The VBA function works correctly and the output looks correct in the
Cell. When I copy and paste that cell from Excel into Notepad, it adds
quotation marks around the beginning and end of the text. I can't figure out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is also a
long string but one which I typed directly into the cell and not from a VBA
function call - there are not quotation marks around the text in Notepad!

Very, very frustrating...any help would be most appreciated...


I can't reproduce with a 100 character string. Can you post the code your
using, or a simplified version that exhibits the same behavior?
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Need help by smart people!!!

OK...I did what you said and I do not get any quotes around Hello when I
paste into Notepad either.

So, I went ahead made a small change to the function as follows:

Function Hello () as String

Hello = "Hello" & vbCrLf & "Hello"

End Function

Guess what? I got this output WITH quotes...

"Hello
Hello"



"Gary''s Student" wrote:

1. Open Notepad
2. Open Excel with a fresh, new, workbook
3. Enter the following UDF:

Function hello() As String
hello = "hello"
End Function

4. In cell A1 of any sheet enter:
=hello()

5. Select the cell; copy the cell; click in Notepad and paste

On my configuration (WinXP and Excel 2002), no quotes (single or double)
appear.

What is you configuration ?
--
Gary''s Student - gsnu200745


"rfusee" wrote:

I posted this yesterday, but noone replied. I'm hoping it's not because
there's no solution to my problem! Here's the deal...

I have a Cell in Excel which calls a VBA function which returns a long
string. The VBA function works correctly and the output looks correct in the
Cell. When I copy and paste that cell from Excel into Notepad, it adds
quotation marks around the beginning and end of the text. I can't figure out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is also a
long string but one which I typed directly into the cell and not from a VBA
function call - there are not quotation marks around the text in Notepad!

Very, very frustrating...any help would be most appreciated...

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Need help by smart people!!!

I'd use:

"line1" & vbLf & "line2"
(vblf = alt-enter)
or
"line1" & vbnewline & "line2"
(vbnewline is platform independent--it'll be vblf in windows and vbcrlf on Macs
(I think).)

But both of them won't fix the problem when you paste to NotePad.

Did you try the code taken from Chip Pearson's site?

It worked ok for me.



rfusee wrote:

Dave,

I use the "line1" & vbCrLf & "line2" .....etc to force new lines within the
cell. Is there a better way?

THANKS!!!!!

"Dave Peterson" wrote:

I bet you have alt-enters in your cell to force new lines within the cell.

Maybe you can do the copying in your code:

I used the PutOnClipboard routine that Chip Pearson has:
http://www.cpearson.com/excel/clipboard.htm

With this sub:
Option Explicit
Sub testme()
PutOnClipboard ActiveCell.Text
End Sub

And then pasted (manually) into NotePad. No double quotes were inserted.

Chip has instructions that you have to follow (including the tools|references
with "Microsoft Forms 2.0 object library") on that sheet.



rfusee wrote:

I posted this yesterday, but noone replied. I'm hoping it's not because
there's no solution to my problem! Here's the deal...

I have a Cell in Excel which calls a VBA function which returns a long
string. The VBA function works correctly and the output looks correct in the
Cell. When I copy and paste that cell from Excel into Notepad, it adds
quotation marks around the beginning and end of the text. I can't figure out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is also a
long string but one which I typed directly into the cell and not from a VBA
function call - there are not quotation marks around the text in Notepad!

Very, very frustrating...any help would be most appreciated...


--

Dave Peterson


--

Dave Peterson


  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Need help by smart people!!!

You must have a new-line character in the string returned by the VBA
function. If you enter a short string in a cell with a new-line character
(Alt-Enter) you will have the same result. It is related to the way the
Paste function work, in Notepad you have no other choice than pasting as
Unformatted Text so the simplest way would be to use WordPad instead, the
default pasting method in NotePad will not put quotation marks around the
string...


"rfusee" wrote in message
...
I posted this yesterday, but noone replied. I'm hoping it's not because
there's no solution to my problem! Here's the deal...

I have a Cell in Excel which calls a VBA function which returns a long
string. The VBA function works correctly and the output looks correct in
the
Cell. When I copy and paste that cell from Excel into Notepad, it adds
quotation marks around the beginning and end of the text. I can't figure
out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is also
a
long string but one which I typed directly into the cell and not from a
VBA
function call - there are not quotation marks around the text in Notepad!

Very, very frustrating...any help would be most appreciated...

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Need help by smart people!!!

The correct newline characters on the different platform is:
Windows: Cr-Lf
Macintosh: Cr
Unix / Linux: Lf


"Dave Peterson" wrote in message
...
I'd use:

"line1" & vbLf & "line2"
(vblf = alt-enter)
or
"line1" & vbnewline & "line2"
(vbnewline is platform independent--it'll be vblf in windows and vbcrlf on
Macs
(I think).)

But both of them won't fix the problem when you paste to NotePad.

Did you try the code taken from Chip Pearson's site?

It worked ok for me.



rfusee wrote:

Dave,

I use the "line1" & vbCrLf & "line2" .....etc to force new lines within
the
cell. Is there a better way?

THANKS!!!!!

"Dave Peterson" wrote:

I bet you have alt-enters in your cell to force new lines within the
cell.

Maybe you can do the copying in your code:

I used the PutOnClipboard routine that Chip Pearson has:
http://www.cpearson.com/excel/clipboard.htm

With this sub:
Option Explicit
Sub testme()
PutOnClipboard ActiveCell.Text
End Sub

And then pasted (manually) into NotePad. No double quotes were
inserted.

Chip has instructions that you have to follow (including the
tools|references
with "Microsoft Forms 2.0 object library") on that sheet.



rfusee wrote:

I posted this yesterday, but noone replied. I'm hoping it's not
because
there's no solution to my problem! Here's the deal...

I have a Cell in Excel which calls a VBA function which returns a
long
string. The VBA function works correctly and the output looks
correct in the
Cell. When I copy and paste that cell from Excel into Notepad, it
adds
quotation marks around the beginning and end of the text. I can't
figure out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is
also a
long string but one which I typed directly into the cell and not from
a VBA
function call - there are not quotation marks around the text in
Notepad!

Very, very frustrating...any help would be most appreciated...

--

Dave Peterson


--

Dave Peterson


  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Need help by smart people!!!

To force a new line within a cell in excel for windows is alt-enter (char(10) or
vblf). (I don't use a Mac.)

If you meant plain old text files, then never mind.



Alain Vaillancourt wrote:

The correct newline characters on the different platform is:
Windows: Cr-Lf
Macintosh: Cr
Unix / Linux: Lf

"Dave Peterson" wrote in message
...
I'd use:

"line1" & vbLf & "line2"
(vblf = alt-enter)
or
"line1" & vbnewline & "line2"
(vbnewline is platform independent--it'll be vblf in windows and vbcrlf on
Macs
(I think).)

But both of them won't fix the problem when you paste to NotePad.

Did you try the code taken from Chip Pearson's site?

It worked ok for me.



rfusee wrote:

Dave,

I use the "line1" & vbCrLf & "line2" .....etc to force new lines within
the
cell. Is there a better way?

THANKS!!!!!

"Dave Peterson" wrote:

I bet you have alt-enters in your cell to force new lines within the
cell.

Maybe you can do the copying in your code:

I used the PutOnClipboard routine that Chip Pearson has:
http://www.cpearson.com/excel/clipboard.htm

With this sub:
Option Explicit
Sub testme()
PutOnClipboard ActiveCell.Text
End Sub

And then pasted (manually) into NotePad. No double quotes were
inserted.

Chip has instructions that you have to follow (including the
tools|references
with "Microsoft Forms 2.0 object library") on that sheet.



rfusee wrote:

I posted this yesterday, but noone replied. I'm hoping it's not
because
there's no solution to my problem! Here's the deal...

I have a Cell in Excel which calls a VBA function which returns a
long
string. The VBA function works correctly and the output looks
correct in the
Cell. When I copy and paste that cell from Excel into Notepad, it
adds
quotation marks around the beginning and end of the text. I can't
figure out
how to make it so that doesn't happen.

Furthermore, if I copy and paste the adjacent Cell in Excel, which is
also a
long string but one which I typed directly into the cell and not from
a VBA
function call - there are not quotation marks around the text in
Notepad!

Very, very frustrating...any help would be most appreciated...

--

Dave Peterson


--

Dave Peterson


--

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
how many people are scheduled between... jat Excel Worksheet Functions 0 October 22nd 09 10:39 PM
Need help of you people malik Excel Worksheet Functions 0 February 16th 09 09:13 PM
Need help of you people malik Excel Worksheet Functions 2 February 16th 09 08:06 PM
Counting people [email protected] Excel Programming 4 July 25th 05 02:00 PM
This is easy for you people! Michael Excel Programming 3 July 4th 05 11:16 AM


All times are GMT +1. The time now is 02:12 AM.

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"