Open URL with VBA without Security Message

TFCJamieFay

Active Member
Joined
Oct 3, 2007
Messages
480
Hi all,

I've got some code that opens a CSV file via a URL. The problem is that I want to open a large number of these files without a security warning message asking me if I'm really really sure I want to open the CSV file (which I am by the way!). Is there any way to bypass this without altering my registry? I'm using the following code (not all of it is here as there's quite a lot of it):

Code:
    'Find the last used row
    intLastrow = Sheets("Daily_Data").Range("A" & Rows.Count).End(xlUp).Row
    dtmMaxDate = Application.Max(Sheets("Daily_Data").Range("A2:A" & intLastrow)) + 1

    intDatesNeeded = (Sheets("Settings").Range("Today").Value - dtmMaxDate)
    Select Case intDatesNeeded
        Case 0
            MsgBox "The Daily_Data sheet is upto date."
            Exit Sub
        Case Else
            ReDim arrDatesNeeded(0 To intDatesNeeded)
            For intCounter = UBound(arrDatesNeeded) To LBound(arrDatesNeeded) Step -1
                arrDatesNeeded(intCounter) = Sheets("Settings").Range("Today").Value - intCounter
                strURLDate = Format(arrDatesNeeded(intCounter), "yyyymmdd")
                strURL = _
                    "https://www.MyURL.com\" & strURLDate
                ActiveWorkbook.FollowHyperlink Address:=strURL

Many thanks,

Jamie
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Have you tried turning off alerts?
Code:
Application.DisplayAlerts = False
 
Upvote 0
Yes, sorry I missed that off my code. See below:

Code:
Sub macUpdateDaily_Data()

On Error GoTo ErrorHandler

    'Turn screen updates and alerts off
    With Application
        .DisplayAlerts = False
        .ScreenUpdating = False
        .DisplayStatusBar = True
        .StatusBar = "Updating Daily_Data Worksheet..."
        .Calculation = xlCalculationManual
    End With
 
Upvote 0
Jamie

So even with that you still get the errors?

Have you looked into adding the URL to Trusted Locations?

Not the full URL for a file but the 'base' URL, eg https://www.MyURL.com\.
 
Upvote 0
Hi Norie,

No, I'm not sure how to do that? I had a quick look at my browser settings, but couldn't see anyway to do that. The file is from a web-based system that I use all day, so I'm not sure if that would help.

I think I'll just have to bite the bullet!

Thanks for all your help,

Jamie
 
Upvote 0
Hi Norie,

No, I'm not sure how to do that? I had a quick look at my browser settings, but couldn't see anyway to do that. The file is from a web-based system that I use all day, so I'm not sure if that would help.

I think I'll just have to bite the bullet!

Thanks for all your help,

Jamie
 
Upvote 0
Jamie

It's not a browser setting, it's an Excel setting which you can find in the Trust Center which you can access via Options.
 
Upvote 0

Forum statistics

Threads
1,215,051
Messages
6,122,872
Members
449,097
Latest member
dbomb1414

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