Outlook 2007 Copy Text Field

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
You gave me the code to copy the e-mail address which worked perfecting, and it works for other objects in the Contact form, but not for the new fields I created....so here is the code you gave me and I substituted the TextBox for the Email1Address and it does not work....so is there an easy way to fix this?

Sub CopyStatusDate()

Dim oContact As ContactItem

'DataObj As MSForms.DataObject
Set oContact = ActiveExplorer().Selection.Item(1)
Set DataObj = New MSForms.DataObject
DataObj.SetText oContact.TextBox4
DataObj.PutInClipboard

End Sub
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Thanks so much. So the test of the code is the same?
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
I did the following and it did not work and the line I changed shows up yellow:
Sub CopyStatusDate()

Dim oContact As ContactItem

'DataObj As MSForms.DataObject
Set oContact = ActiveExplorer().Selection.Item(1)
Set DataObj = New MSForms.DataObject
DataObj.SetText oContact.UserProperties("TextBox4")
DataObj.PutInClipboard

End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Oh, the textbox is not a field - it's a control. The line i gave you is for custom fields. You'll probably need to use a controls("textbox") line like you did in the other macros.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
So what is the code for purposes of copy please?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I have no idea - some partition of this i presume - item.getinspector.modifiedformpages("General").controls("Phone1").text - but i have no idea for sure.

DataObj.SetText oContact.getinspector.modifiedformpages("General").controls("textbox")

or maybe

DataObj.SetText oContact.controls("textbox").value
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Thanks to the Smart Woman!!!:):D:rolleyes:

I tried them and that did not work, but you said before to refer to userproperties....so instead of the name of the textbox, since each textbox is with a field that I created so each one holds all as I was told each textbox should refer to a new fields...so I used the names of the fields and it works!!!

But, the text that is a date, shows up in the contact with the words...for example, Thursday, November 29, 2013 but when I paste what from macro that copies it, it shows up as just numbers 13/29/2013 7am.....so see below that works for both dates and words and is there something to adjust so when I paste the date, is the words and the date etc. And secondly, itstead of copy whats in the textbox, can we change the macro so it deletes whats in the textbox?

Thanks so so much!!

Sub CopyStatusDate()

Dim oContact As ContactItem

'DataObj As MSForms.DataObject
Set oContact = ActiveExplorer().Selection.Item(1)
Set DataObj = New MSForms.DataObject
DataObj.SetText oContact.UserProperties("Status Date")
DataObj.PutInClipboard

End Sub

Sub CopyStatus()

Dim oContact As ContactItem

'DataObj As MSForms.DataObject
Set oContact = ActiveExplorer().Selection.Item(1)
Set DataObj = New MSForms.DataObject
DataObj.SetText oContact.UserProperties("First Status:")
DataObj.PutInClipboard

End Sub
 
Status
Not open for further replies.
Top