Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Alt Enter vs. Chr(13)

I have entered text into an autoshape and used "Alt-Enter" as CR/LF while
inputting the text. Now reading that text thru vba, I'm trying to replace the
Alt_Enter (shows up as a square in my text string) with a space by using;

txt_1= ActiveSheet.Shapes(SelectedShape).DrawingObject.Ca ption
txt_2= Replace(txt_1, Chr(13), " ")

This does not work. Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Alt Enter vs. Chr(13)

Try Chr(10), this is a line feed. or try Chr(13) & Chr(10), or try
vbCrLf

Charles

Steve wrote:
I have entered text into an autoshape and used "Alt-Enter" as CR/LF while
inputting the text. Now reading that text thru vba, I'm trying to replace the
Alt_Enter (shows up as a square in my text string) with a space by using;

txt_1= ActiveSheet.Shapes(SelectedShape).DrawingObject.Ca ption
txt_2= Replace(txt_1, Chr(13), " ")

This does not work. Any ideas?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Alt Enter vs. Chr(13)

Steve wrote:
I have entered text into an autoshape and used "Alt-Enter" as CR/LF while
inputting the text. Now reading that text thru vba, I'm trying to replace the
Alt_Enter (shows up as a square in my text string) with a space by using;

txt_1= ActiveSheet.Shapes(SelectedShape).DrawingObject.Ca ption
txt_2= Replace(txt_1, Chr(13), " ")

This does not work. Any ideas?


try also chr(10) or both.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Alt Enter vs. Chr(13)

Instead of Chr(13) you need to use Chr(10), or
equivalently (and preferably, IMHO) vbLf

Andrew

Steve wrote:
I have entered text into an autoshape and used "Alt-Enter" as CR/LF while
inputting the text. Now reading that text thru vba, I'm trying to replace the
Alt_Enter (shows up as a square in my text string) with a space by using;

txt_1= ActiveSheet.Shapes(SelectedShape).DrawingObject.Ca ption
txt_2= Replace(txt_1, Chr(13), " ")

This does not work. Any ideas?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Alt Enter vs. Chr(13)

Try:
txt_2= Replace(txt_1, vbCrLf, " ")

If that isn't it, then try replacing chr(13) with chr(10)

--
Regards,
Tom Ogilvy


"Steve" wrote:

I have entered text into an autoshape and used "Alt-Enter" as CR/LF while
inputting the text. Now reading that text thru vba, I'm trying to replace the
Alt_Enter (shows up as a square in my text string) with a space by using;

txt_1= ActiveSheet.Shapes(SelectedShape).DrawingObject.Ca ption
txt_2= Replace(txt_1, Chr(13), " ")

This does not work. Any ideas?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Alt Enter vs. Chr(13)

Thanks for the quick replies, unfortunately, none of them worked. Forget I
said CR/LF. I guess what I need to know is how can I replace whatever special
code an "Alt Enter" generates with a space?

"Tom Ogilvy" wrote:

Try:
txt_2= Replace(txt_1, vbCrLf, " ")

If that isn't it, then try replacing chr(13) with chr(10)

--
Regards,
Tom Ogilvy


"Steve" wrote:

I have entered text into an autoshape and used "Alt-Enter" as CR/LF while
inputting the text. Now reading that text thru vba, I'm trying to replace the
Alt_Enter (shows up as a square in my text string) with a space by using;

txt_1= ActiveSheet.Shapes(SelectedShape).DrawingObject.Ca ption
txt_2= Replace(txt_1, Chr(13), " ")

This does not work. Any ideas?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Alt Enter vs. Chr(13)

txt_2= Replace(txt_1, vbLf, " ")
seems to work for me.

Charles

Steve wrote:
Thanks for the quick replies, unfortunately, none of them worked. Forget I
said CR/LF. I guess what I need to know is how can I replace whatever special
code an "Alt Enter" generates with a space?

"Tom Ogilvy" wrote:

Try:
txt_2= Replace(txt_1, vbCrLf, " ")

If that isn't it, then try replacing chr(13) with chr(10)

--
Regards,
Tom Ogilvy


"Steve" wrote:

I have entered text into an autoshape and used "Alt-Enter" as CR/LF while
inputting the text. Now reading that text thru vba, I'm trying to replace the
Alt_Enter (shows up as a square in my text string) with a space by using;

txt_1= ActiveSheet.Shapes(SelectedShape).DrawingObject.Ca ption
txt_2= Replace(txt_1, Chr(13), " ")

This does not work. Any ideas?


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Alt Enter vs. Chr(13)

Actually I'm confused about this: Alt-Enter is used to create line
breaks in a Cell. but your text is in a Shape, where line breaks
are created by Enter or Ctrl-Enter. I think you need to find exactly
what characters you've got the

After:
txt_1= ActiveSheet.Shapes(SelectedShape).DrawingObject.Ca ption
Add this:
Dim i as Integer, c as String
For i = 1 to Len(txt_1)
c = mid(txt_1,i,1)
Debug.Print "Character " & i & " is Chr( " & Asc(c) & ")"
Next

and see what you get..





Steve wrote:
Thanks for the quick replies, unfortunately, none of them worked. Forget I
said CR/LF. I guess what I need to know is how can I replace whatever special
code an "Alt Enter" generates with a space?

"Tom Ogilvy" wrote:

Try:
txt_2= Replace(txt_1, vbCrLf, " ")

If that isn't it, then try replacing chr(13) with chr(10)

--
Regards,
Tom Ogilvy


"Steve" wrote:

I have entered text into an autoshape and used "Alt-Enter" as CR/LF while
inputting the text. Now reading that text thru vba, I'm trying to replace the
Alt_Enter (shows up as a square in my text string) with a space by using;

txt_1= ActiveSheet.Shapes(SelectedShape).DrawingObject.Ca ption
txt_2= Replace(txt_1, Chr(13), " ")

This does not work. Any ideas?


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 415
Default Alt Enter vs. Chr(13)

Steve,
Use vbLF instead, which is actually ASCII 10.

NickHK
P.S. ASCII 13 is vbCr.


"Steve" ...
I have entered text into an autoshape and used "Alt-Enter" as CR/LF while
inputting the text. Now reading that text thru vba, I'm trying to replace
the
Alt_Enter (shows up as a square in my text string) with a space by using;

txt_1= ActiveSheet.Shapes(SelectedShape).DrawingObject.Ca ption
txt_2= Replace(txt_1, Chr(13), " ")

This does not work. Any ideas?



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Alt Enter vs. Chr(13)

Thank you everyone. The "vbLf" did the trick. I must have typo'd the first
time I tried it. I just used Alt-Enter out of habit when typing in the shapes.

Also,
Thanks Andrew for the debug code.

"NickHK" wrote:

Steve,
Use vbLF instead, which is actually ASCII 10.

NickHK
P.S. ASCII 13 is vbCr.


"Steve" ...
I have entered text into an autoshape and used "Alt-Enter" as CR/LF while
inputting the text. Now reading that text thru vba, I'm trying to replace
the
Alt_Enter (shows up as a square in my text string) with a space by using;

txt_1= ActiveSheet.Shapes(SelectedShape).DrawingObject.Ca ption
txt_2= Replace(txt_1, Chr(13), " ")

This does not work. Any ideas?






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
Macro to select cells in column enter data then press enter NP New Users to Excel 1 February 20th 08 04:21 PM
Enter multiple numbers in a cell so total shows when enter keypres newbie Excel Worksheet Functions 2 August 19th 07 12:23 PM
Enter info in one sheet, auto enter in another based on one field The BusyHighLighter[_2_] New Users to Excel 1 August 1st 07 10:54 PM
Auto enter date when data in enter in another cell Brian Excel Worksheet Functions 5 December 7th 06 06:44 PM
What does hitting Ctrl + Shift + Enter to enter a formula do??? Help a n00b out. qwopzxnm Excel Worksheet Functions 2 October 20th 05 09:06 PM


All times are GMT +1. The time now is 07:53 PM.

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"