MS Office Warning (Some files can contain viruses)

QasimMGM

New Member
Joined
Nov 18, 2020
Messages
11
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi,
This is my second question in this great group,
every time I use VBA codes to open files in my laptop; I got a warning (attached).
is there any way to stop this warning?
 

Attachments

  • 1.png
    1.png
    7 KB · Views: 92
Investigate a little bit security.

I have been simulating your code and find that you need to add location to the trusted location.

1. Go to the Trust Center, press button Trust Center Location then select Trusted Location from left menu.
2. Press button Add new location. Specify full path location from your code. Then OK, OK, OK.
3. Save workbook. Close workbook. Open Workbook again and try code from first post again.

If this not help I don't what may be.
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Investigate a little bit security.

I have been simulating your code and find that you need to add location to the trusted location.

1. Go to the Trust Center, press button Trust Center Location then select Trusted Location from left menu.
2. Press button Add new location. Specify full path location from your code. Then OK, OK, OK.
3. Save workbook. Close workbook. Open Workbook again and try code from first post again.

If this not help I don't what may be.
Thank you very much for your response,
I already tried this and didn't work ?
 
Upvote 0
What is content of the cell?
VBA Code:
i = Cells(ActiveCell.Row, 1).Text
 
Upvote 0
Since you have 64bit Office, you'll need:

Code:
Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
                                      (ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, _
                                       ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
This works perfectly
thank you very much ❤
 
Upvote 0
Now I see one error. Replace sign "+" with sign "&" in the path name.
 
Upvote 0

Forum statistics

Threads
1,217,047
Messages
6,134,280
Members
449,863
Latest member
Snowmanx812

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top