PDA

View Full Version : Solved: scrollbar.width property problem on other computers



ukdane
01-19-2009, 07:27 AM
I have a problem, I've added some scrollbars to a form, and it works without any problems on my computer (the form is maximised).
However on some of my colleagues computers they get a runtime error.
What's odd is that we are all running the same version of Excel, and Windows.

Why is this happening, and how do I resolve it.

Here's the code:
Private Sub UserForm_Activate()
Dim myheight As String
Dim mywidth As String
'maximise form to fill window
Application.WindowState = xlMaximized

With Application
Me.Top = .Top
Me.Left = .Left
Me.Height = .Height
Me.Width = .Width
myheight = .Height + .Top
mywidth = .Left

Me.ScrollHeight = myheight
Me.ScrollWidth = mywidth
'Me.ScrollLeft = .Left
'Me.ScrollTop = .Top
populateform1
populateform4
update_bttn.Visible = True
addlink_bttn.Visible = True
End With
End Sub


The result of the code should be that the window is maximised to the size of excel. But if the user reduces the size of excel, then they can use the scroll bars to navigate around the form. (Maybe there is a better way of doing this).

Cheers

ukdane
01-19-2009, 07:47 AM
I've discovered the problem,
We work with two screens, and people with it open on the "wrong" side were causing .left to be a negative number. So it didn't work.