XP vs 2000 macro error

M

Michael Miazga

I have written a few macros for a spreadsheet, I wrote them using Office XP.
The first adds a .gif where it needs to be and protects the document. The
second unprotects the doc, adds another .gif and reprotects the doc. They
work great using my Office XP excel 2002, when I try to run the second one
on a Office 2000 machine, I get an error that says this cannot be done on a
protected document. Is there a difference in syntax between office xp and
office 2000? The office xp box is on winxp, the office 2000 box is win2k.
Here is the code for the second macro, runs great on office xp.

Sub approval_signature()

Dim curWks As Worksheet
Dim Cell
Dim myPictName As Variant
Dim myPict As Picture

Set curWks = ActiveSheet
Set Cell = Range("K36")
Set Cell2 = Range("J36")
myPictName = Application.GetOpenFilename
If myPictName = False Then
Exit Sub
End If

With curWks
.Unprotect Password:="********"
Set myPict = .Pictures.Insert(myPictName)
With Cell
myPict.Top = .Top
myPict.Width = .Width
myPict.Left = .Left
myPict.Height = .Height
.Locked = True
End With
With Cell2
.Clear
.Font.Bold = True
.Value = Date
.Locked = True
End With
.Protect Password:="********"
End With

MsgBox "Approved and worksheet protected"

End Sub
 
M

Michael Miazga

Okay- very odd. If I install the Microsoft Visual Basic Help files, the
macro runs fine. Anyone have any idea what it installs that clears this up?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Looping to insert photo 8
Insert Picture 6
How do i select an inserted image. 1
Insert picture 4
Remove an inserted picture 7
Need Help with Print Out of Userform 1
Multipage?? 1
Printing Userform Part2? 5

Top