Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass CRLF to Excel in VBA

Status
Not open for further replies.
Mar 29, 2004
120
US
I'd like to code my GRANT EXECUTE statements in Excel, like if I have a sql stored procedure called myProc in Excel A1 field, this is the formula I'd type in B1:

="grant execute to " & A1 & CHAR(10) & " go"

But the result contains quotes, like this:

"grant execute to myProc
go"


How can I get rid of these quotes?

Thanks!
 


Hi,

The only way to get
[tt]
"grant execute to myProc
go"
[/tt]
is
[tt]
="""grant execute to " & A1 & CHAR(10) & " go"""
[/tt]


Skip,

[glasses] [red]Be Advised![/red]
The band of elderly oriental musicians, known as Ground Cover, is, in reality...
Asian Jasmine![tongue]
 
SkipVought,

Thank for the reply. My point is I don't want the qoutes at all. I want the expression to appear as:

grant execute to MyProc
go


But when my formula is ="grant execute to " & A1 & CHAR(10) & " go" it appears fine in Excel, but when I copy/paste it it has quotes, like this:

"grant execute to MyProc
go"



 


And my point was that it takes special effort to DISPLAY quotes.
[tt]
="grant execute to " & A1 & CHAR(10) & " go"
[/tt]
displays NO QUOTES.

Skip,

[glasses] [red]Be Advised![/red]
The band of elderly oriental musicians, known as Ground Cover, is, in reality...
Asian Jasmine![tongue]
 
That's correct, it DOES take special effort to display quotes. I don't want to display them. Not only do I not want to display them, but when I copy thje result of the formula from Excel to notepad, I don't want to see the quotes.

My problem is that when the formula is as:
="grant execute to " & A1 & CHAR(10) & " go"

The pasted result DOES display quotes. Try it and see, pasted result looks like:

"grant execute to MyProc
go"


Maybe this has to do with my Excel settings? I want the pasted result to be as:

grant execute to MyProc
go

Thanks


 
I got the same results using Notepad, however, if I used Wordpad, it works fine. Just be sure to save your Wordpad file as txt.
 


Who said ANYTHING about pasteing into Notepad or Wordpad.

The question was about Excel.

Paste or Paste Special - Values, results in NO QUOTES.

I simply do not understand the dilema!

Skip,

[glasses] [red]Be Advised![/red]
The band of elderly oriental musicians, known as Ground Cover, is, in reality...
Asian Jasmine![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top