Good morning everyone, I am a beginner when it comes to VBA and such. I have a problem that I feel is an easy fix for someone with more experience. My macro will not work if the file is renamed. Very quickly, the user clicks a button, and it downloads a preloaded file and loads it to the workbook. Can someone point me in the right direction?
Sub Data() ' ' Macro4 Macro ' ' Workbooks.Open Filename:= _ "excel file location" Range("A1:H1").Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Windows("Tool.xlsm").Activate Sheets("datasheet").Select Range("B2").Select ActiveSheet.Paste Sheets("BCard").Select Application.WindowState = xlNormal Windows("data.xlsx").Activate Application.DisplayAlerts = False ActiveWindow.Close Sheets("BCard").Select Application.WindowState = xlMaximized End Sub