Add Spaces to String

rtdc

Registered User.
Local time
Today, 18:33
Joined
Feb 27, 2007
Messages
55
Silly one really I should know the answer but. I am trying to put spaces into a string that will be used as the body in an email but I am dammed if I can remember which command or chr() to use. The plane is to have a line in the email like: -

Name............................................Fred Bloggs

But without the dots.

Any ideas on how this will look as a string command? I’ve got a total blank at the moment.

Cheers.
 
Hi

I tried the "Name" & Space(20) & "Fred Bloggs" but it still came out

Name Fred Bloggs

Thanks though.
 
Hmmm,
When you type:
?"Name" & Space(20) & "Fred Bloggs"
...in the immediate window, what happens?
Maybe posting more of your code will help.
 
Hi

If you put ?"Name" & Space(20) & "Fred Bloggs" in the intermeadiate window it does exactly what is says it should do and put 20 spaces in, also "Name" & Chr(32) & Chr(32) & "Fred Bloggs" in the window puts in two spaces as I would expect.

Something wierd going on, when it arrives at outlook 2003 there are no spaces.

My code is (part of)

Dim BOD as string

BOD = "Name" & Space(20) & "Fred Bloggs"

Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.to = NME
.Subject = I & " - " & HEAD
.HTMLBody = BOD

I have also tried it with olFormatHTML, olFormatPlain and no change.

Maybe its a outlook issue whcuh would'nt suprise me, anyway I have spoken with the client and we will get around it with a word attachment insetad of a formatted email. A cop out I know but it keeps the project moving forward.

Cheers.
 
I too suspect it is an Outlook issue but glad you figured out a work around. Thanks for posting back.
 

Users who are viewing this thread

Back
Top Bottom