ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comment and Tab character (https://www.excelbanter.com/excel-programming/357604-comment-tab-character.html)

John Keith[_2_]

Comment and Tab character
 
I am placing into a cell comment the Text value from a file. (it happens to
be some short SQL program statements)

In the *.SQL file tab chars CHR(9) have been stored so that when viewing the
file in Notepad the Table/field names line up nicely. How do I make this
happen when the text is placed into a comment.

Range(sCell).Comment.Text Text:=sSQLtext
sSQLtext is read in with OpenTextFile and a .ReadAll

I have the comment shape resizing automatically but I am getting unprintable
characters showing as a box. CHR(10) works properly to line break. But 9s
and 13s are showing as the unprintable default box-character. I figure I can
just relpace the 13's with a space CHR(32).. but for the 9's that will change
the appearance of the text.

Is there a setting that will make the CHR(9) actually tab to a position with
in the comment text box?

I was hoping to not have to use the "brute-force" method and process the
text character by character storing when a new line starts and count the
characters to know exactly how many spaces to replace the CHR(9) with.
--
Regards,
John

NickHK

Comment and Tab character
 
John,
How about using a fixed width font and Replace Chr(9) with x number of
spaces.

NickHK

"John Keith" wrote in message
...
I am placing into a cell comment the Text value from a file. (it happens

to
be some short SQL program statements)

In the *.SQL file tab chars CHR(9) have been stored so that when viewing

the
file in Notepad the Table/field names line up nicely. How do I make this
happen when the text is placed into a comment.

Range(sCell).Comment.Text Text:=sSQLtext
sSQLtext is read in with OpenTextFile and a .ReadAll

I have the comment shape resizing automatically but I am getting

unprintable
characters showing as a box. CHR(10) works properly to line break. But

9s
and 13s are showing as the unprintable default box-character. I figure I

can
just relpace the 13's with a space CHR(32).. but for the 9's that will

change
the appearance of the text.

Is there a setting that will make the CHR(9) actually tab to a position

with
in the comment text box?

I was hoping to not have to use the "brute-force" method and process the
text character by character storing when a new line starts and count the
characters to know exactly how many spaces to replace the CHR(9) with.
--
Regards,
John





All times are GMT +1. The time now is 06:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com