Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default XP vs 2000 macro error

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default XP vs 2000 macro error

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?



"Michael Miazga" wrote in message
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Macro error after switching from Excel 2000 to Excel 2003 Jake Burnham Excel Discussion (Misc queries) 1 January 10th 06 08:10 PM
How do I resolve debug error macro Excel 2000? At least, any lead Excel 2000 Macros debugger Excel Discussion (Misc queries) 5 October 25th 05 08:56 AM
How can I disable error pop-ups in Excel 2000? Daibrush Excel Discussion (Misc queries) 3 January 14th 05 09:19 AM


All times are GMT +1. The time now is 02:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"