LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default refering to details in another sub

Hi
I have an option button which provides an Input Box once selected.

What I would like to know if there is some way I can refer to the
information provided to the input box in another Sub.

ie
First person selects opt button and they enter the information into an input
box called stMessage, When all other details on the form are entered the
person selects a command button called Email to send attach the form to an
email and send.

But I also need to add the information stored in stMessage to go into the
main body of the email.

What I dont know how to do is to pick-up the stMessage from the opt button
and use it in the command button sub.

Following is the Code I have

Private Declare Function Message _
Lib "optAllComm" Alias "EmailMessage" _
(ByVal lpEmail As String, nSize As Long) As Long


Function EmailMessageA()

Dim lpEmail As String
Dim lngret As Long

EmailMessageA = lpEmail

End Function

Private Sub optAllComm_Click()

Dim stMessage As String

stMessage = Application.InputBox("Comments")

End Sub


Private Sub cmdActioned_Click()


Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem


Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)

With OutMail
.To = stName
.CC = ""
.BCC = ""
.Subject = "QRP Actioned, No is " & stqrp
.Body = stName & "," & vbNewLine & EmailMessageA & vbNewLine &
vbNewLine
.Attachments.Add ActiveWorkbook.FullName
.Send 'or use .Display
End With


Set OutMail = Nothing
Set OutApp = Nothing

End Sub

Any help would be great.
Thanks
Noemi
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
refering to other workbooks cjbarron5 Excel Discussion (Misc queries) 2 June 2nd 08 08:17 PM
Refering a cell Arun Kumar Saha Excel Worksheet Functions 2 June 18th 07 12:48 PM
Refering to Cells madh83 Excel Worksheet Functions 3 July 19th 06 11:39 PM
refering to a workbook name within vba DarrenWood[_5_] Excel Programming 4 July 1st 05 11:43 PM
Refering to Names VJ Excel Programming 2 April 21st 05 05:40 PM


All times are GMT +1. The time now is 11:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"