|
-
Apr 13th, 2009, 08:55 AM
#1
Excel VBA - OLEObject Error When WorkBook Is Set As "Shared"
I have a command button on a worksheet (not on a UserForm). It is a save button, and it used to be simply enabled/disabled depending on whether it was eligible for use.
It has been discovered, however, the folks are not using the save button. Rather then are saving their spreadsheets using the build-in Excel Save functions. The problem is that my button does more than just save their work. It also takes pieces of information off of their spreadsheet and puts it on a summary spreadsheet that goes to management in the form of a report. There in lies the problem when they do not use my save button.
So, one suggestion was to make it really big and change the back/fore colors on it to make it standout. I did that, and here is the resulting code.
vb Code:
With cmdSaveHFR
.Enabled = True
.BackColor = vbRed
.ForeColor = vbYellow
.Height = 43.5
.Left = 8.25
.Top = 178.5
.Width = 108.5
.Caption = "Click ME To Save HFR To Disc And To Update HFR Dbase File"
End With
'this puts it back to normal
With cmdSaveHFR
.Enabled = False
.BackColor = &HE0E0E0
.ForeColor = &HC00000
.Height = 19.5
.Left = 8.25
.Top = 189.75
.Width = 108.75
.Caption = "Save HFR"
End With
This works just fine until I set the spreadsheet with the button on it to "Shared" - when it is shared, and it must be shared as it is a menu type spreadsheet used by several different people in three different departments, my button sizing code generates a 1004 error, Unable to set the Height property of the OLEObject Class (if I comment out .Height =, then it will go right through the .Left .Top and .Width properties with this same error.)
So, my question is why can I change the buttons height, left, top and width when the workbook is NOT "Shared", but get an OLEObject error when attempting to make the same change when the workbook is "Shared"?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|