473,396 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Use replace function with multiple replacement substrings

Hi all,
VB novice bear with me...
trying to build myself a template in Outlook to make life easier

I am aquiring multiple subtrings from the user and want to replce one
substring in a outlook template with multiple substring... but i get
an error!

For a = 1 To d
i = i + 1
AGMessage = "Enter the name of the agent in " + TLInput + "'s team:"
AGTitle = "Agent"
Select Case i
Case 1
AGInput1 = InputBox(AGMessage, AGTitle) 'AGInputx are the
substrings
Case 2
AGInput2 = InputBox(AGMessage, AGTitle)
Case Else
ErrorMessage = "Enter atleast one agent or do not send this email"
End Select
Next a

Set NewMail = objOLApp.CreateItemFromTemplate("G:\ak\shared12\Re al
Time Traffic Management\Outlook\Templates\ContactedTL.oft")
NewMail.SentOnBehalfOfName = "Traffic Management"
NewMail.To = "Akarsh Shetty"
NewMail.Subject = "FOLLOW UP REQUIRED - " + AGInput1 + AGInput2 + "
require notification of change to their skill-set"
NewMail.HTMLBody = Replace(NewMail.HTMLBody, "Staff Member",
AGInput1) 'cannot figure out how to add more than 1 substring

thanks all

NewMail.Send

Jun 5 '07 #1
1 3508
On Jun 5, 4:42 pm, roots_of_culture <akar...@gmail.comwrote:
I am aquiring multiple subtrings from the user and want to replce one
substring in a outlook template with multiple substring...

NewMail.Send
Figured out the ansgwer to my own question, stupid of me to overlook
it. I just assigned all the substrings to a master variable which i
then used as a substring:
l = AGInput1 + AGInput2
NewMail.HTMLBody = Replace(NewMail.HTMLBody, "Staff Member", l)
On the same note of being a novice I cant figure out how to do an
error check
I tried writing the code below but i must have got something wrong. I
am trying to disable the "OK" button if the user inputs a value less
than 1.

'prompt for number of agents
ANMessage = "Enter the number of agents"
ANTitle = " # of Agents"
ANInput = InputBox(ANMessage, ANTitle)
d = ANInput
If d < 1 Then 'this does not work - though i
thought it would
cmdOK.Enabled = False
Else
cmdOK.Enabled = True
End If
ideas??

Jun 5 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: K.Simon | last post by:
Hello, it's very often neccessary to replace strings or a single character in my stylesheets. My solution looks awful and very long. Now i thought to solve this with an array like structure but...
24
by: Wim Roffal | last post by:
Is there a possibility to do a string replace in javascript without regular experessions. It feels like using a hammer to crash an egg. Wim
13
by: M | last post by:
Hi, I've searched through the previous posts and there seems to be a few examples of search and replacing all occurrances of a string with another string. I would have thought that the code...
22
by: Michael Nahas | last post by:
Antti & all interested, The draft description of my language to replace C is available at: http://nahas.is-a-geek.com/~mike/MyC.pdf I am a long time C programmer (I read the old testament...
19
by: Paul | last post by:
hi, there, for example, char *mystr="##this is##a examp#le"; I want to replace all the "##" in mystr with "****". How can I do this? I checked all the string functions in C, but did not...
12
by: Michael | last post by:
In PHP there is a function called str_replace (http://php.net/str_replace). Basically you can freed in two strings and a "subject" string. Then it goes through the subject string searching for...
21
by: gary | last post by:
How would one make the ECMA-262 String.replace method work with a string literal? For example, if my string was "HELLO" how would I make it work in this instance. Please note my square...
8
by: Warren Moxley | last post by:
Hi there, i've been searching for a C String search and replace function. I need to find all occurrences of " " in a char* array, and replace them with another char, I know how to do this in...
1
by: neovantage | last post by:
Hey all, I am using a PHP script which creates headings at run time in a sense at page execution. I am stuck a with a very little problem which i am sure i will have the solution from experts. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.