473,395 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Word 2007 VBA - Me.Control has different value to FormName.Control

16
Hi all,
I have been scratching my head over this one for a day now!

I have a word 2007 document with 2 user forms, Form1 and Form2. Form2 is activated from Form1 and should let the user select a value from a listbox and have that value sent to a textbox Text1 in Form1.

I am doing this as follows:

in Form1 module
Expand|Select|Wrap|Line Numbers
  1. Public Sub SetCode(ByVal Code as String)
  2. Me.Field1.Value=Code
  3. End Sub
in Form2 module
Expand|Select|Wrap|Line Numbers
  1. Private Sub Button_Click()
  2. SelectedValue = Me.ListBox1.Column(0)
  3. Call Form1.SetCode(SelectedValue)
  4. Unload Me
  5. End Sub
When the button click code runs in Form2, nothing appears in Field1 on Form1.

While trying to resolve this I found that if I add a command button to Form1 that says
Expand|Select|Wrap|Line Numbers
  1. msgbox Form1.Field1.value
It returns the selected value, even though Field1 appears blank.

If I add a line that says
Expand|Select|Wrap|Line Numbers
  1. msgbox me.Field1.value
It returns no value.

If I run a line from Form1 that says
Expand|Select|Wrap|Line Numbers
  1. me.Field1.value = Form1.Field1.value
It sets the value of Field1 to the value that was previously selected in Form2.

I've tried refreshing and repainting Form1 and adding DoEvents and other methods of refreshing/updating the screen with no luck. It appears that when a variable is sent to a form1 field from form2, that variable can be found in form1.control but not me.control, and the value of me.control does not appear on form1 (even though me.name = form1 when checked.

I'm just about to bite the bullet and just put my big listbox on Form1 instead of its own form to resolve this but I'd be very grateful for any suggestions to fix/work around!
Apr 8 '14 #1
0 1178

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Gops | last post by:
I've find out few XML Node differences in the Migrated word 2007 document and Native Word documnet 2007 Open XML format. For Example, In Migrated word 2007 <w:p> <w:pPr> ...
1
by: Darsin | last post by:
What i am doing is to pull the data from a CMS and import it to Word 2007 Beta and i also have to export the data from Word 2007 Beta back to that CMS. We have with us two Web Services of the CMS....
2
by: Sasie7679 | last post by:
Dear All, We currently use word in our application. We hide the title bar of word and display it in a ActiveX control (just the textual area). We use the below API for hiding the title bar. ...
4
by: Bob Darlington | last post by:
I'm using the following code to check whether Word is running: Function IsAppRunning(strAppname As String) As Boolean Dim strClassName As String Select Case LCase$(strAppname) Case "Excel": ...
0
by: ppardi | last post by:
I'm developing an addin for Word 2007 and I need to determine whether a user saves a Word 2007 document in an older format (97-2003) after a save as is done. The scenario is that the user starts...
5
by: sphinney | last post by:
Basic question: Does anyone know how to go about adding a control to an Access 2007 form that will allow viewing a Word 2007 document? Reason for asking: My office is about to receive 100+/-...
0
JAMBAI
by: JAMBAI | last post by:
I am using a OLE unbound Control to Embed the word document in the form load, event like this http://support.microsoft.com/kb/209990 and When i double clicks (In Place activation), the documents...
1
by: melx | last post by:
I am working on a protected word 2007 form. How can different people track changes in the unprotected text form fields? The text appears in black and changing the track changes option doesn't change...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.