Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
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 | Excel Worksheet Functions | |||
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 | Excel Discussion (Misc queries) | |||
Macro error after switching from Excel 2000 to Excel 2003 | Excel Discussion (Misc queries) | |||
How do I resolve debug error macro Excel 2000? At least, any lead | Excel Discussion (Misc queries) | |||
How can I disable error pop-ups in Excel 2000? | Excel Discussion (Misc queries) |