VBA User Form Code Issues in MS 365

Denny57

Board Regular
Joined
Nov 23, 2015
Messages
246
Office Version
  1. 365
Platform
  1. Windows
I have just downloaded MS365 (Office) to a second laptop (Windows 10 as 11 cannot be supported) under my MS account and accessed a file from the OneDrive.

This file contains a VBA coded User Form which works fine on my Surface Pro 7 (Windows 11). However, I am experiencing some VBA code issues when I try to input information into the User Form.

I have checked the Excel options and Advanced Settings and these are the same on both devices. I fully expect more problems late in the code but initially the problem arises when I key in the first field of information.

Text Box txtWeight - The code formats the keyed information and there is an AutoTab property to the next TextBox (txtBPSystolic).

As soon as I key information into the txtWeight textbox the developeer code appears and the word Format appears highlighted indicating an error in the code in Me.txtWeight = Format(Me.txtWeight, "#,##0.0").

When I select END from the message box the same happens for the next sub.

This suggest that perhaps "Format" is no longer supported in the latest downloadable version of MS365.

VBA Code:
Dim Currentrow As Long
Dim wsDailyStatistics As Worksheet
Private Sub FullDetails_Click()
End Sub
Private Sub UserForm_Initialize()

    txtDate = ""
    txtDayNumber = ""
    txtWeight = ""
    txtBPSystolic = ""
    txtBPDiastolic = ""
    txtPulse = ""
    txtBloodOxygen = ""
    txtMorning = ""
    txtMidday = ""
    txtEvening = ""
    
    txtWeight.SetFocus
    
    Set wsDailyStatistics = ThisWorkbook.Worksheets("Daily Statistics")
     cmdUpdate.Enabled = False
        
End Sub
Private Sub txtWeight_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.txtWeight = Format(Me.txtWeight, "#,##0.0")
End Sub
Private Sub txtBPSystolic_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.txtBPSystolic = Format(Me.txtBPSystolic, "#,##0")
End Sub
Private Sub txtBPDiastolic_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.txtBPDiastolic = Format(Me.txtBPDiastolic, "#,##0")
End Sub

In addition, once I have selected to exit and accept that the debugger will stop the process, I cannot get the file or Excel to close. I have close Excel through Task Manager.

Hoping that this might be a simple issue and not that MS have made changes to VBA.

Thanks in advance
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
In the VB Editor goto Tools, References. Is anything listed as "Missing"?
 
Upvote 0
In the VB Editor goto Tools, References. Is anything listed as "Missing"?
Fluff Thank you. This identified that Common Controls were missing. I have downloaded this and it initially showed as being present

I thengot a different error

Compile error!

Can't Find Project or library

which highlights Private Sub txtWeight_Exit(ByVal Cancel As MSForms.ReturnBoolean).

Then as I click to close and get the message "This will stop the Debugger" and click OK, these messages keep looping and I cannot exit excel.

After closing using Task manager, I opened the file and checked the Tools - Resources and Common Controls wre missing once again
 
Upvote 0
You will need to register it, but I cannot remember how to do that, as I no longer use them.
 
Upvote 0
Fluff

I have opened and checked a number of files some with VBA user forms and some without.

Only those with forms produce the library / objects not found messages.

Similarty the Common Controls are still missing even though I have downloaded these and run the .exe process
 
Upvote 0
Hi Fluff

I have resolved the problem by unchecking common controls. Further investigation identified that Common Controls runs
Microsoft Animation Control
Microsoft UpDown Control
Microsoft MonthView Control
Microsoft Date and Time Picker Control
Microsoft Flat ScrollBar Control

I recall that later versions of MS 365 does not support these controls. In order to use the Date and Time Picker control, I had to install an earlier version of MS 365.

Thanks for the heads up about common controls as I would never had thought of looking for that.
 
Upvote 0
Solution
Glad you sorted it & thank for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top