Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Change the numeric value of a dropdown to text value

1 view
Skip to first unread message

Worsty

unread,
Jan 7, 2010, 12:51:49 PM1/7/10
to
I'm trying to email the values of form fields that I have created in a
form. So basically what I want to do is in the Subject I want to take
the "value" of the dropdown called dropdown1 and put it in the
subject. It is working but it is putting the numeric value instead of
the text value. How do I convert it.

Thanks much!

Doug Robbins - Word MVP

unread,
Jan 8, 2010, 5:56:04 AM1/8/10
to
Use the .Result, not the .Value

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Worsty" <dwo...@gaic.com> wrote in message
news:7f763b13-21a8-49b8...@u41g2000yqe.googlegroups.com...

Worsty

unread,
Jan 8, 2010, 8:39:24 AM1/8/10
to
On Jan 8, 5:56 am, "Doug Robbins - Word MVP" <d...@REMOVECAPSmvps.org>
wrote:
> > Thanks much!- Hide quoted text -
>
> - Show quoted text -

Thanks Doug, but when I put .Result in my code it gives me this error.
Method or data member not defined error. I also put some additional
code case statement (below) and then it didn't work at all.

Here is what I have so far.

Public Sub CommandButton1_Click()

'This macro requires the Outlook Object library to be checked

'in the vba editor Tools > References
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem


If Len(ActiveDocument.Path) = 0 Then 'Document has not been saved
ActiveDocument.Save 'so save it
End If
'see if Outlook is running and if so turn your attention there
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then 'Outlook isn't running
'So fire it up
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
'Open a new e-mail message
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem 'and add the detail to it
.To = "dwo...@gaic.com" 'send to this address
.Subject = ActiveDocument.FormFields("Dropdown4").DropDown.Result
'This is the message subject
.Body = "See attached document" ' This is the message body text
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue
.Display
'**********************************
'If you want to view the message before it goes
'change the line above from .Send to .Display
'Otherwise the message is sent straight to the Outbox
'and if you have Outlook set to send mail immediately,
'it will simply be Sent
'with no obvious sign that Outlook has operated.
'Apart from the copy in the Outlook Sent folder
'**********************************
End With
If bStarted Then 'If the macro started Outlook, stop it again.
oOutlookApp.Quit
End If
'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing

End Sub

*****************************************************************************************************

I tried to put the following code at the top of my Email code but then
I got nothing.

Any help would be appreciated.

Dim myString As String
Select Case _
ActiveDocument.FormFields("Dropdown3").DropDown.Value

Case 2
myString = "Two"
Case 3
myString = "three"

MsgBox ("I got here")
End Select
'ActiveDocument.FormFields("Text31").Result = myString

On Error Resume Next

Doug Robbins - Word MVP

unread,
Jan 8, 2010, 3:12:58 PM1/8/10
to
.Subject = ActiveDocument.FormFields("Dropdown4").DropDown.Result

should be

.Subject = ActiveDocument.FormFields("Dropdown4").Result

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Worsty" <dwo...@gaic.com> wrote in message

news:8cce47a2-5f14-4fc6...@26g2000yqo.googlegroups.com...

Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages