Can not type in the Custom VBA Macro Form

Can not type in the Custom VBA Macro Form

staffordm
Explorer Explorer
657 Views
16 Replies
Message 1 of 17

Can not type in the Custom VBA Macro Form

staffordm
Explorer
Explorer

We use a VBA program that will open these menus. Everything works with the Macros except I can not type inside the inputs of these custom pop-ups. This issue began yesterday. The pop-up acts like it is not active (note the word takeoff is grey, it should be dark as that pop-up would be the active window). Anything I type goes to the command line.

 

I don't know what setting got changed yesterday. The VBA is saved on our shared server and no one else in my group is having this issue. So I believe this is a localized issue on my PC.

 

Can anyone help?

AutoCAD 2020 (yes, I know, old)
Windows 11 64-bit

0 Likes
658 Views
16 Replies
Replies (16)
Message 2 of 17

norman.yuan
Mentor
Mentor

It seems to me that the UI, which you referred to as "custom pop-ups", is shown as modeless, that is, the code that shows the UI is like

 

UserForm.show 1

 

or 

 

UserForm Show vbModeless

 

When VBA 's UI (UserForm) is shown as modeless in AutoCAD, it behaves exactly as you described: it cannot hold onto the focus and user cannot interact with the UI, UNLESS an special UI control AcFocusCtrl is added to the UserForm.

 

Since you said this just happened recently (meaning it worked OK before), it suggests that the UI indeed had the acFocusCtrl applied to, but for some reason(s) it stopped working. Therefore, it is difficult to tell what caused it: did you install AutoCAD update, or did Windows got updated?...

 

You probably need to open the VB project (*.dvb file) in AutoCAD's VBA Editor to examine whether the UI has the AcFocusCtrl applied correctly (maybe it is lost for some unknown reason). When you see the UI/UserForm in VBA's editor, you should see the AcFocusCtrl on the UI, as the picture below shows:

normanyuan_0-1751473740802.png

If you do not see it, then it was lost. You would either add it back, or change the way how the UI is shown (i.e. showing the UI as modal/dialog), if applicable.

 

 

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 17

staffordm
Explorer
Explorer

Norman,

 

When I check the forms, that AcFocusCtrl is missing. The .dvb file we use is on a central place on our server that we all use. I have check other PC's on my team and the AcFocusCtrl is visible on their computers. This explains why I am the only person having this issue.

I have done the following without any resolution:

  1. Tried to add the AcFocusCtrl in the VBA editor to the forms, when I do I get the following error message (image attached): "The subject is not trusted for the specified action."
  2. I have uninstalled VBA_Enabler. Restarted the PC. Then installed VBA_enabler. No change.
  3. I have uninstalled VBA_Enabler. Reset AutoCAD settings to default. Installed VBA_enabler. Opened AutoCAD and reloaded my profile. Tried the VBA macro and no change.

I will try unloading AutoCAD completely this afternoon, and then re-install.
That "not trusted for specified action" leads me to believe that this is some deep Windows setting on my PC that will take someone knowledgeable in these kind of things to help with (I will ask my IT group).

 

If it helps anyone that might know, here's my Windows version information:
Edition: Windows 11 Pro 64-bit
Version 24H2
OS build 26100.4484
Experience Windows Feature Experience Pack 1000.26100.128.0

0 Likes
Message 4 of 17

Ed__Jobe
Mentor
Mentor

The error indicates that the the dll has a certificate issue or is not properly registered. First try this: 

Open file explorer and navigate to the path below. Then right click on the dll and choose Properties. Make sure the file is unblocked. If it's not, there will be a button in the lower right to Unblock.

Open cmd.exe as an administrator. Then run the following command:

regsvr32 "C:\Program Files\Common Files\Autodesk\Shared\AcFocusCtrl.dll"

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 5 of 17

staffordm
Explorer
Explorer

Ed,

 

I am using AutoCAD 2020 (I know, we need to update, been busy).... So has that file path changed?
I have a similar file located here: 

C:\Program Files\Common Files\Autodesk Shared\AcFocusCtrl16.dll


But I'm wondering if that "16" at the end is different. In this folder above, there is not a AcFocusCtrl.dll file.
Also, If I change the location to this path above and run regsvr32, I get the error in the image below. My IT guy is researching this, too.

 

 

0 Likes
Message 6 of 17

Ed__Jobe
Mentor
Mentor

Right click on the Toolbox in the VBA editor when editing the form. Select >Additional Controls. click on the acFocusCtrl control and note the path in the bottom of the form.

Try running "rgsvr" instead of regsvr32.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 7 of 17

staffordm
Explorer
Explorer

When I try doing this as rgsvr in the command prompt, it says "'rgsvr' is not recognized as an internal or external command, operable program or batch file."

 

And my location for acFocusCtrl is the same as your image. But there is not a file in that location. So nothing loads when I try using regsvr32 in that location.

0 Likes
Message 8 of 17

norman.yuan
Mentor
Mentor

Normally, no one needs to "register" acFocusCtrl separately: it installed with AutoCAD. If in doubt, you can scan Windows registry with Registry Editor. You should be able to find a key in the HKEY_CLASSES_ROOT\CLSID for this class item:

 

HKEY_CLASSES_ROOT\CLSID\{B5B91160-9818-4E96-BD97-B981A7AF8E06}

 

If you do not find it, something is wrong with your AutoCAD installation. But it is there, then things could be worse.

 

You want to try to reinstall AutoCAD. If you have multiple AutoCAD version installed, try VBA Editor in each of them to see whether the acFocusCtrl is not available in all ACAD versions or only in one version. At the worst scenario, you may have to uninstall all AutoCAD versions and then reinstall.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 9 of 17

staffordm
Explorer
Explorer

I tried uninstalling AutoCAD and the VBA module. Then installed both. This did not resolve the issue. That's why I kind of believe this is a windows issue.

0 Likes
Message 10 of 17

staffordm
Explorer
Explorer

Norman,

 

My IT did check my registry and I do have that key. You said "if it is there, things could be worse". So how worse?

0 Likes
Message 11 of 17

norman.yuan
Mentor
Mentor

"Worse" means that it appears the AcFocusCtl component is indeed in the Window registry (COM component must be "registered" to be useful), yet, your VBA IDE does not see it. Just to be sure when you do this:

1. Go into AutoCAD VBA IDS (enter command "VBAIDE" in AutoCAD). As matter of fact, you can go to any other VBA IDE, say Excel, Word...;

2. Add a UserForm, so that the toolbox would show up;

3. Right-click the bottom of the toolbox and select "Additional Control..." context menu;

4. You should see a dialog box pops up to show all available COM UserControls available in this computer. If you do not see AcFocusCtl (yet it is registered in the registry), that is what I mean "WORSE".

normanyuan_0-1752612589450.png

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 12 of 17

Ed__Jobe
Mentor
Mentor

It may be that the wrong version of the dll is registered. The file name should just be acFocusCtrl.dll, not *.16.dll. Did you have an older version of acad installed at one time? You might try going to Control Panel>Programs and Features and click on acad. Then choose Repair/Reinstall. Try the Repair option before reinstalling. If you need to reinstall, be sure to do a clean uninstall.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 13 of 17

staffordm
Explorer
Explorer

I have tried repair and uninstall but it didn't repair the issue. I might have to do the clean uninstall steps.

The only problem with the dll name being AcFocusCtrl16.dll is that I have checked the other PC's on my team sharing the same VBA file. All those PC's have the same file name in the same location and are not having this issue. But maybe that also means that my file is corrupted and didn't get fully replaced in the uninstall that I've tried.

0 Likes
Message 14 of 17

Ed__Jobe
Mentor
Mentor

Backtracking, are you sure you installed the vba enabler for 2020 and not some other version?

 

You said you were too busy to upgrade. If you are going to reinstall, why not install the latest version, for which you are sure that you can get the correct vba enabler?

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 15 of 17

staffordm
Explorer
Explorer

Yes I do have the correct VBA enabler. And all other aspects of VBA and the macros are working. It's just this one focus control on my PC that isn't working.

0 Likes
Message 16 of 17

h_s_walker
Mentor
Mentor

This might work (It might not as well) Copy the AcFocusCtrl16.dll file from one of the working PCs and overwrite the file on your machine. First check the date / time stamp on it and yours. Are they different? If they aren't you might have a corrupted file.

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 17 of 17

Ed__Jobe
Mentor
Mentor

@staffordm  Again, you could have upgraded by now and that would have most likely solved the problem.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes