PDA

View Full Version : Solved: Tab character



mdmackillop
11-09-2004, 09:58 AM
Hi all,
Is there a character I can enter in Excel, which converts to a Tab when the cell contents are pasted into Word. I've tried Alt + 9 with no success.
MD

mvidas
11-09-2004, 10:16 AM
Hey MD,

You could use char(9)

I just put ="a"&CHAR(9)&"b" into a cell, copied it, then in word did Edit / Paste Special / Unformatted Text
Pasted as "a b"

Matt

mvidas
11-09-2004, 10:17 AM
thats odd, when I pasted it in (and when I see it in word) there is an actual tab there, although in word its really only one character long (same as normal tabs)

mdmackillop
11-09-2004, 04:15 PM
The requirement is for use in this ongoing project, where I would like imported text to fit defined tab stops.
(save the xls file in C:\Amerge)

mvidas
11-09-2004, 04:32 PM
Cool program by the way :)

Anyways, as an example, I changed B6 to be ="35 South London Road"&CHAR(9)&"Apt 2" and when I clicked on Add1 it shows the tab in the textbox. when i double click it, the space is there between the Road and Apt, and Apt starts at the next tab stop

I may be missing something though..

mdmackillop
11-09-2004, 04:42 PM
You're right Matt, I must have been careless with my quotes, the = sign or something.
Thanks,
MD

mvidas
11-09-2004, 04:45 PM
Not a problem, you may want to have a worksheet_change event in there or something saying something like
if not isnumeric(target.text) and if left(target.formula)<>"=" then
target.formula="=""" & target.text & """"
end if

that way if you forget to enter text in that manner (which would be annoying to do every time), it does it for you

Just a thought

mdmackillop
11-09-2004, 04:47 PM
BTW, the code may have written a couple of values to your registry

Private Sub SaveData(TBox, Data)
SaveSetting "TxtSelect", TBox, "Data", Data
End Sub

mvidas
11-09-2004, 04:51 PM
BTW, the code may have written a couple of values tp your registry

Private Sub SaveData(TBox, Data)
SaveSetting "TxtSelect", TBox, "Data", Data
End Subas long as it doesn't slow down my computer i dont really care :)

mdmackillop
11-10-2004, 12:33 PM
Hi Matt,
I've updated the Excel file in the zip file to change the word "tab" to Char(9) and add the = sign etc. Seems to work. :)
MD

mvidas
11-11-2004, 08:45 AM
Thats a smart idea! You may want to change it to #tab or something just in case one of the cells needs to contain the actual word tab.
Glad you got it straightened out!

mdmackillop
11-11-2004, 10:18 AM
Good idea,
I've also sorted out a #Var routine that inserts a macrobutton in word to allow for easy insertion of variables

Anne Troy
11-16-2004, 07:56 AM
Hey, MD. Is this solved, then?

:)

mdmackillop
11-16-2004, 03:57 PM
Slap on the wrist!!!

Anne Troy
11-16-2004, 03:59 PM
ROFL!!