Email and string space removal

gordsky

Well-known Member
Joined
Jun 2, 2016
Messages
556
Office Version
  1. 2016
Platform
  1. Windows
Hi, I currently have a macro to send emails using vba and our internal email to sms system

It works find except when the recipe string finds a space.

I currently have
dim recip as string
Ctr = 2
Recip = cells(ctr, 6) & "@sms.htkmessaging.com"

The info at (ctr, 6) sometimes contains a phone number which due to the way it is imported sometimes has a space in it eg 01234 567 677

The system fails if a space is present so is it possible to remove the spaces from within the code.

I know I could remove them prior to running the macro but I want to be able to do it all in one action

Many thank
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
please use 'code tags' when posting code here.

perhaps
Code:
Recip = Replace(Cells(ctr, 6), " ", "") & "@sms.htkmessaging.com"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,605
Messages
6,120,473
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top