ORegistry.CreateKey HKEY_CURRENT_USER, sNewKey SNewKey = sParentKey & "\Location" & CStr(iLocCounter + 1) ORegistry.SetDWORDValue HKEY_CURRENT_USER, sParentKey, "AllowNetworkLocations", 1 'Uncomment the following 4 linesif your wish to enable network locations as Trusted If CInt(Mid(sChildKey, 9)) > iLocCounter Then If sValue = spath Then bAlreadyExists = True ORegistry.GetStringValue HKEY_CURRENT_USER, sParentKey & "\" & sChildKey, "Path", sValue ORegistry.EnumKey HKEY_CURRENT_USER, sParentKey, arrChildKeys SParentKey = "Software\Microsoft\Office\" & vers & "\Excel\Security\Trusted Locations" Set oRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv") 'Determine the location/path of the user's MyDocuments folder What is the proper way to achieve what I'm after?ĭim sDescription 'Description of the Trusted Locationĭim bAllowSubFolders 'Enable subFolders as Trusted Locationsĭim bAllowNetworkLocations 'Enable Network Locations as Trusted What I'm trying to achieve is to get the "Enable Editing" button removed, so this macro can enable editing and run as planned.Ĭurrently, the code falls at the "Set wb" line. I have added in the "If" statement in the sub as I was hoping it would remove the "Protected View - Editing this file type is not recommended due to your File Block settings in the Trust Center" message. , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False ActiveWorkbook.SaveAs FileName:=Trim(strPath) & "ASC.xlsx" _ Workbooks.Open(Trim(strPath) & "ASC.xls", True, False) Sub RunASCFormatting(xl As Excel.Application, wb As Excel.Workbook, strPath As String) I have a spreadsheet I open programmatically using the VBA in Access: Set xl = CreateObject("Excel.Application")
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |