Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-26-2022, 09:53 AM
grNadpa grNadpa is offline setfocus crashes in word form textbox sub Windows 10 setfocus crashes in word form textbox sub Office 2016
Advanced Beginner
setfocus crashes in word form textbox sub
 
Join Date: Mar 2022
Posts: 46
grNadpa is on a distinguished road
Default setfocus crashes in word form textbox sub

Attempting to set focus on next logical textbox from code in current textbox using VBA in Word2016 running windows 10 on a Dell Laptop.
My test form has two text boxes with default names Textbox1 and Textbox2.
Code:
Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    TextBox2.SetFocus
End Sub
Message from TextBox1MouseDown sub is
Quote:
Run-time error '-2147417848(80010108)':
Automation error
The object invoked has disconnected from its clients.
(I have screen shots in my word folder, but I find that the insert Image icon in this editor requires an URL )

I can close the dialog and form. But when I try to close the word document I get a messagebox
Quote:
You cannot close Microsoft Word because a dialog box is open.


Click OK, switch to Word, then close the dialog box.
But there is no other dialog box visible -- forcing me to invoke the task manager and manually end the Word task.

Curiously, I have no problem using setfocus within my command button Click sub.

When I remove the setfocus, the text1 box remains active and the user must tab. So it's not a crisis, just tacky.
Reply With Quote
 

Tags
mouse controllable, vba change textbox word, word 2016-64



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass the selected in Combobox to a Textbox of a Word form Visor Word VBA 10 07-24-2020 08:38 AM
Validate textbox fields in VBA Form before Submit ScottyBee Word VBA 5 03-20-2019 04:46 PM
Create a ComboBox in a Form that creates a new document and autofills a textBox BlackGirlMagic Word VBA 5 02-13-2017 02:39 PM
how to save contents in textbox in VB2013 form into a Word document? saltlakebuffalo Word VBA 6 12-10-2014 06:12 PM
PowerPoint 2007 Textbox Lock / Form Issues LTechie12 PowerPoint 0 01-08-2012 02:08 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft