![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
I need to have a variable number of fields on a form with different names
based upon an array of names I've succesfully built the form using the code below InitUserFields . UF is a dynamic array of field names UFV is a matching array of initial values for each field. Now I need to retrieve the values that the user enters into the form and store them back in UFV. I've tried to use EXECUTE & EVAL as shown in the sub GetUserFields but I get the error sub or function not defined on ECECUTE or EVAL whichever I use. I've included references to VB Applications Extensibility 5.3 and Excel 11.0 Object library without any difference. Does anyone have a better idea of how to achieve this? Sub InitUserFields(UF, UFV) Dim X As Integer Dim NewLabel, NewTextbox For X = 0 To UBound(UF) Set NewLabel = Me.Controls.Add("Forms.label.1") With NewLabel .Name = UF(X).Name & "Title" .Caption = UF(X).Name .Top = 252 .Left = 366 + X * 94 .Width = 90 .Height = 12 .Font.Name = "Tahoma" End With Set NewTextbox = Me.Controls.Add("Forms.textbox.1") With NewTextbox .Name = UF(X).Name .Value = UFV(X) .Top = 264 .Left = 366 + X * 94 .Width = 90 .Height = 15.75 .Font.Name = "Tahoma" End With Next End Sub Sub GetUserFields(UF, UFV) Dim X As Integer For X = 0 To UBound(UF) Execute (UFV(X) = "Me." & UF(X).Name & ".Value") Next End Sub |
#2
|
|||
|
|||
![]()
Sorry, but I don't see what this has to do with Outlook custom forms.
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "John Bacon" wrote in message ... I need to have a variable number of fields on a form with different names based upon an array of names I've succesfully built the form using the code below InitUserFields . UF is a dynamic array of field names UFV is a matching array of initial values for each field. Now I need to retrieve the values that the user enters into the form and store them back in UFV. I've tried to use EXECUTE & EVAL as shown in the sub GetUserFields but I get the error sub or function not defined on ECECUTE or EVAL whichever I use. I've included references to VB Applications Extensibility 5.3 and Excel 11.0 Object library without any difference. Does anyone have a better idea of how to achieve this? Sub InitUserFields(UF, UFV) Dim X As Integer Dim NewLabel, NewTextbox For X = 0 To UBound(UF) Set NewLabel = Me.Controls.Add("Forms.label.1") With NewLabel .Name = UF(X).Name & "Title" .Caption = UF(X).Name .Top = 252 .Left = 366 + X * 94 .Width = 90 .Height = 12 .Font.Name = "Tahoma" End With Set NewTextbox = Me.Controls.Add("Forms.textbox.1") With NewTextbox .Name = UF(X).Name .Value = UFV(X) .Top = 264 .Left = 366 + X * 94 .Width = 90 .Height = 15.75 .Font.Name = "Tahoma" End With Next End Sub Sub GetUserFields(UF, UFV) Dim X As Integer For X = 0 To UBound(UF) Execute (UFV(X) = "Me." & UF(X).Name & ".Value") Next End Sub |
#3
|
|||
|
|||
![]()
Well in my eyes it's a formin OUTLOOK customised by VBA, but maybe I don't
understand what Outlook custom forms implies, in which case please point me to the correct forum in case I get another problem in future. Thanks. "Sue Mosher [MVP]" wrote: Sorry, but I don't see what this has to do with Outlook custom forms. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "John Bacon" wrote in message ... I need to have a variable number of fields on a form with different names based upon an array of names I've succesfully built the form using the code below InitUserFields . UF is a dynamic array of field names UFV is a matching array of initial values for each field. Now I need to retrieve the values that the user enters into the form and store them back in UFV. I've tried to use EXECUTE & EVAL as shown in the sub GetUserFields but I get the error sub or function not defined on ECECUTE or EVAL whichever I use. I've included references to VB Applications Extensibility 5.3 and Excel 11.0 Object library without any difference. Does anyone have a better idea of how to achieve this? Sub InitUserFields(UF, UFV) Dim X As Integer Dim NewLabel, NewTextbox For X = 0 To UBound(UF) Set NewLabel = Me.Controls.Add("Forms.label.1") With NewLabel .Name = UF(X).Name & "Title" .Caption = UF(X).Name .Top = 252 .Left = 366 + X * 94 .Width = 90 .Height = 12 .Font.Name = "Tahoma" End With Set NewTextbox = Me.Controls.Add("Forms.textbox.1") With NewTextbox .Name = UF(X).Name .Value = UFV(X) .Top = 264 .Left = 366 + X * 94 .Width = 90 .Height = 15.75 .Font.Name = "Tahoma" End With Next End Sub Sub GetUserFields(UF, UFV) Dim X As Integer For X = 0 To UBound(UF) Execute (UFV(X) = "Me." & UF(X).Name & ".Value") Next End Sub |
#4
|
|||
|
|||
![]()
Outlook custom forms are the UI/code templates for Outlook message, contact,
and other items. They're quite different from VBA user forms. Questions about those go in the microsoft.public.outlook.program_vba newsgroup. And, please, always include your version of Outlook when you post. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "John Bacon" wrote in message ... Well in my eyes it's a formin OUTLOOK customised by VBA, but maybe I don't understand what Outlook custom forms implies, in which case please point me to the correct forum in case I get another problem in future. Thanks. "Sue Mosher [MVP]" wrote: Sorry, but I don't see what this has to do with Outlook custom forms. "John Bacon" wrote in message ... I need to have a variable number of fields on a form with different names based upon an array of names I've succesfully built the form using the code below InitUserFields . UF is a dynamic array of field names UFV is a matching array of initial values for each field. Now I need to retrieve the values that the user enters into the form and store them back in UFV. I've tried to use EXECUTE & EVAL as shown in the sub GetUserFields but I get the error sub or function not defined on ECECUTE or EVAL whichever I use. I've included references to VB Applications Extensibility 5.3 and Excel 11.0 Object library without any difference. Does anyone have a better idea of how to achieve this? Sub InitUserFields(UF, UFV) Dim X As Integer Dim NewLabel, NewTextbox For X = 0 To UBound(UF) Set NewLabel = Me.Controls.Add("Forms.label.1") With NewLabel .Name = UF(X).Name & "Title" .Caption = UF(X).Name .Top = 252 .Left = 366 + X * 94 .Width = 90 .Height = 12 .Font.Name = "Tahoma" End With Set NewTextbox = Me.Controls.Add("Forms.textbox.1") With NewTextbox .Name = UF(X).Name .Value = UFV(X) .Top = 264 .Left = 366 + X * 94 .Width = 90 .Height = 15.75 .Font.Name = "Tahoma" End With Next End Sub Sub GetUserFields(UF, UFV) Dim X As Integer For X = 0 To UBound(UF) Execute (UFV(X) = "Me." & UF(X).Name & ".Value") Next End Sub |
#5
|
|||
|
|||
![]()
Sue,
Thanks for that info. Strange thing is I started in that group and got directed to this one. Anyway I've got the solution so that's the most important thing. "Sue Mosher [MVP]" wrote: Outlook custom forms are the UI/code templates for Outlook message, contact, and other items. They're quite different from VBA user forms. Questions about those go in the microsoft.public.outlook.program_vba newsgroup. And, please, always include your version of Outlook when you post. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "John Bacon" wrote in message ... Well in my eyes it's a formin OUTLOOK customised by VBA, but maybe I don't understand what Outlook custom forms implies, in which case please point me to the correct forum in case I get another problem in future. Thanks. "Sue Mosher [MVP]" wrote: Sorry, but I don't see what this has to do with Outlook custom forms. "John Bacon" wrote in message ... I need to have a variable number of fields on a form with different names based upon an array of names I've succesfully built the form using the code below InitUserFields . UF is a dynamic array of field names UFV is a matching array of initial values for each field. Now I need to retrieve the values that the user enters into the form and store them back in UFV. I've tried to use EXECUTE & EVAL as shown in the sub GetUserFields but I get the error sub or function not defined on ECECUTE or EVAL whichever I use. I've included references to VB Applications Extensibility 5.3 and Excel 11.0 Object library without any difference. Does anyone have a better idea of how to achieve this? Sub InitUserFields(UF, UFV) Dim X As Integer Dim NewLabel, NewTextbox For X = 0 To UBound(UF) Set NewLabel = Me.Controls.Add("Forms.label.1") With NewLabel .Name = UF(X).Name & "Title" .Caption = UF(X).Name .Top = 252 .Left = 366 + X * 94 .Width = 90 .Height = 12 .Font.Name = "Tahoma" End With Set NewTextbox = Me.Controls.Add("Forms.textbox.1") With NewTextbox .Name = UF(X).Name .Value = UFV(X) .Top = 264 .Left = 366 + X * 94 .Width = 90 .Height = 15.75 .Font.Name = "Tahoma" End With Next End Sub Sub GetUserFields(UF, UFV) Dim X As Integer For X = 0 To UBound(UF) Execute (UFV(X) = "Me." & UF(X).Name & ".Value") Next End Sub |
#6
|
|||
|
|||
![]()
Silly me, as soon as I'd posted I saw the answer after spending the previous
4 hours loking for a solution. Sub GetUserFields(UF, UFV) Dim X As Integer For X = 0 To UBound(UF) UFV(X) = Me.Controls(UF(X).Name).Value Next End Sub "John Bacon" wrote: I need to have a variable number of fields on a form with different names based upon an array of names I've succesfully built the form using the code below InitUserFields . UF is a dynamic array of field names UFV is a matching array of initial values for each field. Now I need to retrieve the values that the user enters into the form and store them back in UFV. I've tried to use EXECUTE & EVAL as shown in the sub GetUserFields but I get the error sub or function not defined on ECECUTE or EVAL whichever I use. I've included references to VB Applications Extensibility 5.3 and Excel 11.0 Object library without any difference. Does anyone have a better idea of how to achieve this? Sub InitUserFields(UF, UFV) Dim X As Integer Dim NewLabel, NewTextbox For X = 0 To UBound(UF) Set NewLabel = Me.Controls.Add("Forms.label.1") With NewLabel .Name = UF(X).Name & "Title" .Caption = UF(X).Name .Top = 252 .Left = 366 + X * 94 .Width = 90 .Height = 12 .Font.Name = "Tahoma" End With Set NewTextbox = Me.Controls.Add("Forms.textbox.1") With NewTextbox .Name = UF(X).Name .Value = UFV(X) .Top = 264 .Left = 366 + X * 94 .Width = 90 .Height = 15.75 .Font.Name = "Tahoma" End With Next End Sub Sub GetUserFields(UF, UFV) Dim X As Integer For X = 0 To UBound(UF) Execute (UFV(X) = "Me." & UF(X).Name & ".Value") Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
User Defined Fields and Custom Forms | dch3 | Outlook - Using Forms | 2 | August 30th 07 03:34 PM |
How do I upload Custom fields into my Outlook Forms? | madmack | Outlook - Using Contacts | 1 | May 2nd 07 11:03 PM |
Importing Custom Fields & Creating Forms | Simon | Outlook - Using Forms | 1 | October 27th 06 12:38 PM |
Some fields cannot be edited on "All Fields" tab on Contact forms | BR | Outlook - Using Contacts | 1 | February 19th 06 07:54 PM |
Fields on custom forms are not kept after message is sent | Sue Mosher [MVP-Outlook] | Outlook - Using Forms | 2 | February 6th 06 10:06 PM |