Word ContentControl InkPicture Control - vba

My problem is, if i create a form via Word i usually limit editing to only fill in forms (protect document).
However the person who fills out the form need to make drawings in the InkPicture Control Field via a input pen on a tablet.
This is not possible while the editing is limitet to fill forms only. Using the InkPicture ControlField only works while the editing is limited to comments.
Is there a solution fto use InkPicture Control and form fields while limit the editing? (VBA Makro, Settings etc...)

Related

MS Word checkbox control not checkable when saved as PDF

I have a MS Word document that implements a form people can fill in. It is mostly just table cells that represent text fields people can type in and checkbox controls that allow them to check the box to select an option. I then save the document as a PDF document.
When I test the PDF form by selecting the "fill and sign" option, I've found that some checkboxes are "checkable", but others are not. They were all added to the form the same way, so I'm at a loss as to why some work and others do not.
I've looked at the properties of the control, but am not seeing anything different from a working checkbox vs a non-working checkbox.
Has anyone run into this? Any ideas on what could be wrong? Is there a MS forum that might be a better place for this question?

Problem with content controls, when creating new document based on template

I have a template .dotm file in which I have ActiveX buttons and content controls. The document is unprotected and the editing is enabled.
I've tested creating documents based on this template on multiple computers, running Windows 7/Windows 10 and Office 2010, the document based on template can run the VBA code for the ActiveX objects and the content controls are usable (checkboxes, text fields and date pickers).
However, on a specific computer - Windows 7/Office 2010, when I create a new document based on the template (double-clicking the template), the content controls are no longer being displayed, only the placeholders are displayed simply as text. Also, the checkboxes cannot be used, they are simply characters. However, the ActiveX objects are still working and the VBA code inserted in the template runs.
This problem does not occur when opening the template and working directly on template (Right click - open), but this is not the intended use.
In Trust Center > Trust Center Settings > ActiveX Settings and in Trust Center > Trust Center Settings > Macro Settings I've selected the most permissive option, allowing all the controls to be run.
I've added the following scenarios for a better visualisation of the problem:
1. Right Click -> Open (opening the template):
If I enter Design Mode:
As you can see, it's opening with enabled and functioning content controls.
2. Double-click on template/Right Click -> New (new document based on template):
For example, the yellow-highlighted should be a textbox content control, but it's a simple text (I had the cursor on it when I took the screenshot).
Entering Design Mode:
As you can see, there are no content controls. The checkboxes are simple characters and there are no textboxes.
On any other computer, creating new document based on the template (as in case 1) work as intended (the document appear as in case 2, with content controls).
Could you guide me in finding out what is causing this problem with the content controls? Thank you!
After multiple test at different computers, I have noticed that the problem occurs only on those that have Compatibility Mode enabled. At these computers, every new document was opening in Compatibility Mode for Office 2003, even though the templated was saved as .dotm.
In order to disable this compatibility mode, I've changed in File->Options->Save->Save files in this format from Word 97-2003 Document (*.doc) to Word Document (*.docx).

Word document text boxes "remember" what was in them previously

I am using a VBA userform to randomly generate values to be sent into a Word document to provide random questions on various math topics (for my students).
This seems to work well except that when I exit the userform (me.hide) and the values are sent and focus is back in the document, the previous values are still briefly visible every time I move the mouse.
This only happens for an instant. The correctly sent values appear if there is no mouse (or window slider) activity taking place. If I view another application and do some activity there and then return to the Word document the display is fine as well.
The flipping of values is visually annoying. Has anyone out there encountered a similar issue?
To reproduce:
Create a Word document with an ActiveX Textbox and button. The button activates a userform which also contains a Textbox and a button to send the Textbox value back to the Textbox in the document.
In my case, when the button in the document is clicked the form opens and the value does get returned to the Word document, but when rolling the mouse or moving the slider at the edge of the window the previous value in the text box briefly flickers into view. Here is the code from the document button:
Private Sub cmdOk_Click()
ThisDocument.TextBox1.Value = TextBox1.Value
Me.Hide
End Sub
I am using Word 2016 and Windows 10.
I tried to use the "new" Word textboxes but I do not know how to communicate with them from a userform. It is so simple using the "old" text boxes.
ActiveX controls were designed for VBA UserForms. It's possible to insert them on the surface of a Word document or Excel spreadsheet, but they don't always behave optimally. Content controls (and the legacy form fields), on the other hand are designed for the surface of a Word document.
In order to write to a content control you can use code like this:
ActiveDocument.SelectContentControlsByTitle("name").Item(1).Range.Text
Closer to what you're trying to do with identifying the content controls could be:
ActiveDocument.SelectContentControlsByTitle(TextBox1.Name).Item(1).Range.Text = TextBox1.Value
Why it's so complicated: The team that designed content controls wanted to avoid the problems people ran into with bookmarks and form fields, that a name could not be duplicated in a document. It's possible to give the same name to multiple content controls. So it's not possible to identify a content control using Document.ContentControls("name").
Instead, Document.SelectContentControlByTitle needs to be used, which returns an array of content controls. If there's only one (or if you want only one), then you can add on .Item([index]) to get the single content control directly.
Rather than type in a static name, you can query the UserForm's textbox control for its name, if that makes things easier for you.

VBA ActiveX control changes size after sharing

I have a simple excel form with an ActiveX control (ListBox)
When I share this over email, the recipient does the following steps:
1. Open the excel
2. Enable Content for the macro
Now - the ListBox grows in size.
I'm unable to dynamically resize or figure out the exact event for "Enable Content".
Is there anyway I can retain the dimensions of the ListBox?
Your problem has nothing to do with sharing the document via email. It has everything to do with window scaling. To prove this to yourself try connecting to a projector with the the excel document open. Use some Active X controls and they will shrink or Expand. I've had this problem and found the only way to avoid it in a reasonable manor is to implant a form inside the excel document that holds all the needed controls or ensure the end user is not scaling their display in any manor.

MS Excel VBA Forms - Hide Control

I am using MS Excel VBA forms.
On my form, there is a drop down list and based on the selection changed in dropdown, I want to hide and show controls.
I am able to hide the control by setting visible to true on control, but they still occupy space on the form.
Is there any way to collapse control while hiding controls on VBA forms (somewhat similar to WPF visibility = collapse)
Do let me know if you need any other information.