• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Vba macro is navigating to a hyperlink that downloads a file and saves it.

heavican03

New Member
I have a vba macro that is navigating to a hyperlink and downloading a file that is then saved. The only problem I am having with it is I can't get it to stop bringing up the Microsoft office warning that the file might contain harmful files. Can you help?


Code:
I have a vba macro that is navigating to a hyperlink and downloading a file that is then saved. The only problem I am having with it is I can't get it to stop bringing up the Microsoft office warning that the file might contain harmful files. Can you help?



Code:
Sub LinkAndCopy()
   
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
   
   
    ThisWorkbook.FollowHyperlink Address:="http://cts/Tacs/LDCOperationDrillExport/762"
   
    ActiveWorkbook.SaveAs "C:\Users\q6bxh0\Documents\downloads\file.xlsx"
    ActiveWorkbook.Close
   
   
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
   
   
End Sub
 
Last edited:

Reduce security level in Excel options or directly open file from URL
via Workbooks.Open (or OpenText) method or via QueryTable object …

 
Back
Top