Link to home
Create AccountLog in
Avatar of ElrondCT
ElrondCTFlag for United States of America

asked on

Xlsm file odd security setting when created in Excel 2003

I have an Excel macro which converts a .prn text file to a .xlsm macro-enabled spreadsheet.  On a Windows 7 Home Premium machine with the Office Compability Pack installed, running Excel 2003, the spreadsheet created has an odd security setting: in the Security tab of Properties for the file (viewed in Windows Explorer/My Computer), the group "Everyone" is missing. The result is that I cannot view the file when I connect from another, networked computer. I have other macros which convert .prn files to .xls spreadsheets, and they do show the Everyone group, with Full Control permission enabled.

Checking a bit more, I get the same behavior (no Everyone group) if I open a .xls spreadsheet and save it as either .xlsx or .xlsm. I also notice that the icon in the folder listing is slightly different; there's a gold padlock superimposed on the Excel icon. The padlock disappears if I create the Everyone group in the Security tab and give it Full Control.

I don't have this problem when I run the macro in Excel 2007 on another Windows 7 computer, but I have no way to verify whether it's something unusual in one of the computers, or a difference between Excel 2003 and 2007.

I can't see anything in the Excel options tabs that would seem to relate to this, though I may just not be looking in the right place. Any ideas on how to make these worksheets automatically visible & enabled to all in the Everyone group?
ASKER CERTIFIED SOLUTION
Avatar of Lucian Constantin
Lucian Constantin
Flag of Romania image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of ElrondCT

ASKER

Yes, I realize upgrading would resolve the problem, but this is on a computer that gets very little use, and I'm on a tight budget, so I'd prefer not to have to spend the money.

The command you gave works for me if I give it as a command at the command prompt. However, it's not working for me as a Shell command in an Excel macro. I'm getting a 2780 return value from the Shell. Any ideas?
Try using this code sequence:

    Dim objShell, nResult, cCommand
    Set objShell = CreateObject("WScript.Shell")
    cCommand = "C:\Windows\System32\icacls.exe FullPathToXLSMFile /grant Everyone:F"
    'Shell.Run options
    '1=Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
    '2=Activates the window and displays it as a minimized window.
    nResult = objShell.Run(cCommand, 2, True)
    'Debug.Print nResult
    
    'Cleanup
    Set objShell = Nothing

Open in new window

I found the problem. I had a file name with spaces in it, and didn't have quote marks around it. With that done, a Shell command worked fine, without needing the extra stuff.

Thanks for the help!