question

VuNguyen-2618 avatar image
0 Votes"
VuNguyen-2618 asked VuNguyen-2618 commented

Add trusted location via reg file unsuccessfully.

I have added a trusted location via reg file. However, it doesn't seem to be successful but cause the location is greyed out AND it doesn't have the expected effects of a trusted location.

What should I do to be able to add trusted location by registry?

This is my .reg file content and my screen shot

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Security\Trusted Locations\Location8]
"Path"="%UserProfile%\\Desktop\\KTVP\\"
"Description"="KTVP Doc entry file"
"Date"="13/07/2021 06:58 PM"

114414-screenshot36.png


office-vba-devoffice-excel-itpro
screenshot36.png (121.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

VikiJi-MSFT avatar image
0 Votes"
VikiJi-MSFT answered VuNguyen-2618 commented

@VuNguyen-2618,
Welcome to Q&A forum!

In the registry, the key value that defines the system variable path %UserProfile% is different from the regular path.

If you add the KTVP folder as a trusted location through a .reg file, please change the path to "C:\\Users\\Administrator\\Desktop\\KTVP". You could right-click the KTVP folder, and then click Properties to view its specific location. Then double-click the .reg file to run this registry.

 Windows Registry Editor Version 5.00
 [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Excel\Security\Trusted Locations\Location9]
 "Description"="KTVP Doc entry file"
 "Path"="C:\\Users\\Administrator\\Desktop\\KTVP"
 "Date"="13/07/2021 06:58 PM"

It is displayed in the registry as shown below:
114469-image.png


If you want use the "%UserProfile%\Desktop\KTVP" path, please add the following key value in Registry Editor directly and use Expandable String Value to define the folder path as shown below.
114504-image.png

My test results:
114553-image.png
Hope the information could be helpful to you. Any updates, please let me know.


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


image.png (44.4 KiB)
image.png (37.3 KiB)
image.png (28.9 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This is just really strange. I am actually kind of amazed that there are people know this without being the Window development team.

0 Votes 0 ·
TvanStiphout avatar image
0 Votes"
TvanStiphout answered VuNguyen-2618 commented

Grasping at straws: that is not a US date.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1.The way the .reg file was "developed" was just by copying an existing entry in the registry hive. The date format doesn't change
2. I deleted the date in the registry, no dice. Re-added without date, still no dice.

0 Votes 0 ·

I changed an Excel entry into %USERPROFILE% from `C:\Users\Admin` then the entry became greyed out. Could that be the cause?

0 Votes 0 ·