Copying data between atbs in a custom form

Status
Not open for further replies.
B

bear

Hello

I have a custom form. Form is a modified appointment with a second tab for a custom form.

Trying to copy data from custom form/second tab to first tab which a standard Appointment page.

First trying to make sure that a user is in a second tab which is called Transportation Form. When code is executed it should take data from some fields in Transportation Form and copy it over to Appointment tab/first tab.

Not sure how to call tabs. Any help would be appreciated

Sub Appt_From_From()

Dim txtBody1 As String

Dim txtBody2 As String

Dim txtBody3 As String

Dim objCurContact As ContactItem

Dim objAppt As AppointmentItem

Set myFolder = Session.GetDefaultFolder(olFolderCalendar)

Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")

On Error GoTo ErrorCode

If Application.ActiveInspector.CurrentItem.Class <> myItem Then

MsgBox "Error,exiting"

GoTo ErrorCode

Else

Set objCurContact = Application.ActiveInspector.CurrentItem

Set objAppt = myItem
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
This calls a certain control on the names page:

dim ctrl as object

Set ctrl=

Application.ActiveInspector.ModifiedFormPages("name").Controls("name")

You don't need to create the myItem object. If you want to test, whether a

certain item uses your modified form, check its MessageClass property.

Best regards

Michael Bauer

Am Fri, 26 Mar 2010 15:26:08 -0400 schrieb bear:


> Hello
> I have a custom form. Form is a modified appointment with a second tab for


a custom form.

> Trying to copy data from custom form/second tab to first tab which a


standard Appointment page.

> First trying to make sure that a user is in a second tab which is called


Transportation Form. When code is executed it should take data from some

fields in Transportation Form and copy it over to Appointment tab/first tab.
> Not sure how to call tabs. Any help would be appreciated

> Sub Appt_From_From()
> Dim txtBody1 As String
> Dim txtBody2 As String
> Dim txtBody3 As String
> Dim objCurContact As ContactItem
> Dim objAppt As AppointmentItem

> Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
> Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")

> On Error GoTo ErrorCode

> If Application.ActiveInspector.CurrentItem.Class <> myItem Then
> MsgBox "Error,exiting"
> GoTo ErrorCode

> Else

> Set objCurContact = Application.ActiveInspector.CurrentItem
> Set objAppt = myItem

> .
>
 
B

bear

Hello

Here is what I have now and it does not seem to find the form. Not sure how it should be refrenced?

Public Sub Appt_From_Contact()

Dim txtBody1 As String

Dim txtBody2 As String

Dim txtBody3 As String

Dim objCurContact As ContactItem

Dim objAppt As AppointmentItem

Dim ins As Outlook.AppointmentItem

Dim con As Outlook.AppointmentItem

Dim ctrl As Object

On Error GoTo ErrorCode

'Set myFolder = Session.GetDefaultFolder(olFolderCalendar)

'Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")

Set ctrl = Application.ActiveInspector.ModifiedFormPages("IPM.Appointment.Tim3.18.2010 ").Controls("DestinationandAddr").Value

If Application.ActiveInspector.CurrentItem.Class <> olAppointment Then

MsgBox "Error,exiting"

GoTo ErrorCode

Else

Set objCurContact = Application.ActiveInspector.CurrentItem

Set objAppt = Application.CreateItem(ctrl)

mb wrote on Sat, 27 March 2010 01:57
> This calls a certain control on the names page:
> dim ctrl as object
> Set ctrl=
> Application.ActiveInspector.ModifiedFormPages("name").Controls( "name")

> You don't need to create the myItem object. If you want to test, whether a
> certain item uses your modified form, check its MessageClass property.

> > Best regards
> Michael Bauer
> Category Manager -

> SAM - The Sending Account Manager:
>

> Am Fri, 26 Mar 2010 15:26:08 -0400 schrieb bear:
>
> > Hello
> > I have a custom form. Form is a modified appointment with a second tab for

> a custom form.
> > Trying to copy data from custom form/second tab to first tab which a

> standard Appointment page.
> > First trying to make sure that a user is in a second tab which is called

> Transportation Form. When code is executed it should take data from some
> fields in Transportation Form and copy it over to Appointment tab/first tab.
> > Not sure how to call tabs. Any help would be appreciated
> > Sub Appt_From_From()
> > Dim txtBody1 As String
> > Dim txtBody2 As String
> > Dim txtBody3 As String
> > Dim objCurContact As ContactItem
> > Dim objAppt As AppointmentItem
> > Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
> > Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")
> > On Error GoTo ErrorCode
> > If Application.ActiveInspector.CurrentItem.Class <> myItem Then
> > MsgBox "Error,exiting"
> > GoTo ErrorCode
> > Else
> > Set objCurContact = Application.ActiveInspector.CurrentItem
> > Set objAppt = myItem
> > .
> >
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Dim Appt as Outlook.AppointmentItem

Dim ctrl as Object

' Assuming the current item is an appointment

Set Appt=Application.ActiveInspector.CurrentItem

if Appt.MessageClass="IPM.Appointment.Tim3.18.2010" Then

' this AppointmentItem is using your custom form

' here you should be able to access the ModifiedFormPage and the control

by their names

else

' this AppointmentItem probably is using the default form

endif

Best regards

Michael Bauer

Am Mon, 29 Mar 2010 12:44:17 -0400 schrieb bear:


> Hello

> Here is what I have now and it does not seem to find the form. Not sure


how it should be refrenced?

> Public Sub Appt_From_Contact()

> Dim txtBody1 As String
> Dim txtBody2 As String
> Dim txtBody3 As String
> Dim objCurContact As ContactItem
> Dim objAppt As AppointmentItem
> Dim ins As Outlook.AppointmentItem
> Dim con As Outlook.AppointmentItem
> Dim ctrl As Object
> On Error GoTo ErrorCode

> 'Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
> 'Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")

> Set ctrl =


Application.ActiveInspector.ModifiedFormPages("IPM.Appointment.Tim3.18.2010

").Controls("DestinationandAddr").Value
> If Application.ActiveInspector.CurrentItem.Class <> olAppointment Then
> MsgBox "Error,exiting"
> GoTo ErrorCode
> Else

> Set objCurContact = Application.ActiveInspector.CurrentItem
> Set objAppt = Application.CreateItem(ctrl)

> mb wrote on Sat, 27 March 2010 01:57
> > This calls a certain control on the names page:
> > dim ctrl as object
> > Set ctrl=
> > Application.ActiveInspector.ModifiedFormPages("name").Controls( "name")
>

>> You don't need to create the myItem object. If you want to test, whether


a
> > certain item uses your modified form, check its MessageClass property.
>

>> > > Best regards
> > Michael Bauer
> > Category Manager -

> > SAM - The Sending Account Manager:
> >

>
>
>> Am Fri, 26 Mar 2010 15:26:08 -0400 schrieb bear:
> >
> >> Hello
> >> I have a custom form. Form is a modified appointment with a second tab


for
> > a custom form.
> >
>>> Trying to copy data from custom form/second tab to first tab which a

> > standard Appointment page.
> >
>>> First trying to make sure that a user is in a second tab which is called

> > Transportation Form. When code is executed it should take data from some
> > fields in Transportation Form and copy it over to Appointment tab/first


tab.
> >> Not sure how to call tabs. Any help would be appreciated
> >
>>
>>> Sub Appt_From_From()
> >> Dim txtBody1 As String
> >> Dim txtBody2 As String
> >> Dim txtBody3 As String
> >> Dim objCurContact As ContactItem
> >> Dim objAppt As AppointmentItem
> >
>>> Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
> >> Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")
> >
>>> On Error GoTo ErrorCode
> >
>>> If Application.ActiveInspector.CurrentItem.Class <> myItem Then
> >> MsgBox "Error,exiting"
> >> GoTo ErrorCode
> >
>>> Else
> >
>>> Set objCurContact = Application.ActiveInspector.CurrentItem
> >> Set objAppt = myItem
> >
>>> .
> >>


> .
>
 
B

bear

Re: Copying data between tabs in a custom form

Hello

I made modifications. here is what I have now and get an error -2147024809. Error comes up right after ModifiedFormPages("Transportation Form").Controls("DestinationandAddr"). Does it care that there is a space between words Transportation and Form?

Sub FormtoAppt()

Dim txtBody1 As String

Dim txtBody2 As String

Dim txtBody3 As String

Dim objCurContact As ContactItem

Dim objAppt As AppointmentItem

Dim ctrl As Object

Dim Appt As Outlook.AppointmentItem

On Error GoTo ErrorCode

Set Appt = Application.ActiveInspector.CurrentItem

If Appt.MessageClass = "IPM.Appointment.Tim3.18.2010" Then

Set ctrl = Application.ActiveInspector.ModifiedFormPages("Transportation Form").Controls("DestinationandAddr")

Set objCurContact = Application.ActiveInspector.CurrentItem

Set objAppt = Application.CreateItem(ctrl)

> .......................

mb wrote on Tue, 30 March 2010 02:57
> Dim Appt as Outlook.AppointmentItem
> Dim ctrl as Object

> ' Assuming the current item is an appointment
> Set Appt=Application.ActiveInspector.CurrentItem

> if Appt.MessageClass="IPM.Appointment.Tim3.18.2010" Then
> ' this AppointmentItem is using your custom form
> ' here you should be able to access the ModifiedFormPage and the control
> by their names
> else
> ' this AppointmentItem probably is using the default form
> endif

> > Best regards
> Michael Bauer
> Category Manager -

> SAM - The Sending Account Manager:
>

> Am Mon, 29 Mar 2010 12:44:17 -0400 schrieb bear:
>
> > Hello
> > Here is what I have now and it does not seem to find the form. Not sure

> how it should be refrenced?
> > Public Sub Appt_From_Contact()
> > Dim txtBody1 As String
> > Dim txtBody2 As String
> > Dim txtBody3 As String
> > Dim objCurContact As ContactItem
> > Dim objAppt As AppointmentItem
> > Dim ins As Outlook.AppointmentItem
> > Dim con As Outlook.AppointmentItem
> > Dim ctrl As Object
> > On Error GoTo ErrorCode
> > 'Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
> > 'Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")
> > Set ctrl =

> Application.ActiveInspector.ModifiedFormPages("IPM.Appointment.Tim3.18.2010
> ").Controls("DestinationandAddr").Value
> > If Application.ActiveInspector.CurrentItem.Class <> olAppointment Then
> > MsgBox "Error,exiting"
> > GoTo ErrorCode
> > Else
> > Set objCurContact = Application.ActiveInspector.CurrentItem
> > Set objAppt = Application.CreateItem(ctrl)
> > mb wrote on Sat, 27 March 2010 01:57
> >> This calls a certain control on the names page:
> >> dim ctrl as object
> >> Set ctrl=
> >> Application.ActiveInspector.ModifiedFormPages("name").Controls( "name")
> >
> >> You don't need to create the myItem object. If you want to test, whether

> a
> >> certain item uses your modified form, check its MessageClass property.
> >
> >> > >> Best regards
> >> Michael Bauer
> >> Category Manager -

> >> SAM - The Sending Account Manager:
> >>

> >
> >
> >> Am Fri, 26 Mar 2010 15:26:08 -0400 schrieb bear:
> >
> >>> Hello
> >>> I have a custom form. Form is a modified appointment with a second tab

> for
> >> a custom form.
> >>
> >>> Trying to copy data from custom form/second tab to first tab which a
> >> standard Appointment page.
> >>
> >>> First trying to make sure that a user is in a second tab which is called
> >> Transportation Form. When code is executed it should take data from some
> >> fields in Transportation Form and copy it over to Appointment tab/first

> tab.
> >>> Not sure how to call tabs. Any help would be appreciated
> >>
> >>
> >>> Sub Appt_From_From()
> >>> Dim txtBody1 As String
> >>> Dim txtBody2 As String
> >>> Dim txtBody3 As String
> >>> Dim objCurContact As ContactItem
> >>> Dim objAppt As AppointmentItem
> >>
> >>> Set myFolder = Session.GetDefaultFolder(olFolderCalendar)
> >>> Set myItem = myFolder.Items.Add("IPM.Appointment.Tim3.18.2010")
> >>
> >>> On Error GoTo ErrorCode
> >>
> >>> If Application.ActiveInspector.CurrentItem.Class <> myItem Then
> >>> MsgBox "Error,exiting"
> >>> GoTo ErrorCode
> >>
> >>> Else
> >>
> >>> Set objCurContact = Application.ActiveInspector.CurrentItem
> >>> Set objAppt = myItem
> >>
> >>> .
> >>>

> > .
> >
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
E Copying data from e-mail attachement to EXCEL file via macro Outlook VBA and Custom Forms 38
N error when copying outlook data "can not copy: the path too deep" Using Outlook 6
R Copying Data from Exchange to PST file Outlook VBA and Custom Forms 1
R VBA for copying sent email to current folder under a shared mailbox Outlook VBA and Custom Forms 17
E Copying the whole e-mail body into excel Outlook VBA and Custom Forms 0
T Copying Outlook Account Setup For Desktop App Using Outlook 5
J Outlook - 2013 - Error msg when copying folders from Online Archives to another user's mailbox Using Outlook 0
Thiago Manzano Copying E-mails to a folder on HD Using Outlook 1
Diane Poremsky Mark Sent Items as Read After Copying with a Rule New Slipstick.com Articles 0
crazyboy Copying BCM database from backed up mounted image to new drive BCM (Business Contact Manager) 2
oliv- Prevent copying shared contacts Outlook VBA and Custom Forms 5
Paul Butticaz Copying Contacts from SharePoint List (connected to Outlook) to another Conacts folder Using Outlook 1
K Outlook 2010 Not responding after IMAP folder deletion or copying. Using Outlook 2
Mary B Outlook 2013: Rule for copying new email to folder & marking that copy as read Using Outlook 1
S Calendar items are not being uploaded to outlook.com after copying Using Outlook.com accounts in Outlook 1
P open reminders missing after copying outlook pst file Using Outlook 2
L Copying Emails using drag and drop Using Outlook 2
O New to Outlook 2013, dealing with copying vs. moving sent items Using Outlook 0
S Recover messages that disappeared when copying to folder Using Outlook 1
S Copying multiple messages to folders and keeping date/time detail Using Outlook 1
D Copying POP3 folders from Inbox to IMAP Inbox in Outlook 2003 Using Outlook 0
M Copying setups for mutiple users Using Outlook 2
T Location and simple copying of emails and settings, OL 2010 and Win 7 64bit. Using Outlook 3
A Copying additional contact fields when chosing "Contact from the same company" Using Outlook 5
A Copying cc email addresses to Excel - does not copy the <joe.bloggs@isp.com> Using Outlook 1
S Search Indexing (Copying Folders) Using Outlook 0
E Copying multiple folders to PST Outlook VBA and Custom Forms 2
R copying a custom view from a public folder and distributing programatically Outlook VBA and Custom Forms 3
N Copying outlook macros between pcs Outlook VBA and Custom Forms 1
V Copying contents from one field to another field Outlook VBA and Custom Forms 6
V Form data not sending for some users Outlook VBA and Custom Forms 1
D Outlook VBA error extracting property data from GetRules collection Outlook VBA and Custom Forms 10
J Outlook 2013 Change color of text in data fields of contacts in Outlook 2013? Using Outlook 10
T How can Exchange be configured to sync/push one-way so that the server data can't be affected Exchange Server Administration 0
C Can't create Outlook data file Outlook Wishlist 0
T Extract Data From Outlook Tasks Using Outlook 0
F outlook.com Exchane Server corrupts data Since September 2019 Using Outlook.com accounts in Outlook 6
T Extract Data From Outlook Tasks Using Outlook 0
E To convert imported data to custom fields in Task list Outlook VBA and Custom Forms 1
R "Can't store Outlook data files under the AppData folder. Please choose another folder." Using Outlook 6
C How to export Outlook data to csv? Using Outlook 0
RBLampert Assigning a newly (re)created e-mail account to a specific .pst data file Using Outlook 2
S newly added shared mailboxes downloading 500GB data a day Exchange Server Administration 1
M Using field names to capture a data element Using Outlook 0
S Custom Form, copy user field data to message body Outlook VBA and Custom Forms 12
M Outlook 2016 Requesting data from server Using Outlook 0
G Entered data in custom field goes in card and does not stay in list view Outlook VBA and Custom Forms 1
Sofia Manni Some of my favorite data in outlook. Using Outlook 2
A Outlook 2016 Will Not Show Any Data In the People Pane Using Outlook 15
A Script to fetch data from mails in restricted collection and sending them to excel Using Outlook 1

Similar threads

Top