VBA Path Issue

dwool40

New Member
Joined
Apr 27, 2018
Messages
29
I am running the 3 macros below on many computers with no issue. However, on one computer the Downloads module returns a file not found error (53). It's the same path! Is there some reason I can't think of that this would be happening?

VBA Code:
Sub Copynotice()
Dim wb1 As Workbook, wb2 As Workbook
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set wb1 = ThisWorkbook
'enter correct path to Downloads folder
Set wb2 = Workbooks.Open("C:\Users\User1\Dropbox\z_sync_do_not_delete\Downloads\DataGridExport.xlsx")
wb2.Sheets("Report1").Range("E2:E120").Copy
wb1.Sheets("Notice").Range("D3").PasteSpecial Paste:=xlPasteValues
wb2.Close
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

Sub CopyUA()
Dim wb1 As Workbook, wb2 As Workbook
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set wb1 = ThisWorkbook
'enter correct path to Downloads folder
Set wb2 = Workbooks.Open("C:\Users\User1\Dropbox\z_sync_do_not_delete\Downloads\UnitAvailabilityDetails" & Format(Date, "mm_dd_yyyy") & ".xlsx")
wb2.Sheets("Report1").Range("A10:R300").Copy
wb1.Sheets("Unit Availability").Range("A8").PasteSpecial Paste:=xlPasteValues
wb2.Close
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

Sub Downloads()
'enter correct path to Downloads folder
Kill "C:\Users\User1\Dropbox\z_sync_do_not_delete\Downloads\*.*"
End Sub
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

JEC

Well-known Member
Joined
Aug 21, 2021
Messages
957
Office Version
  1. 365
Platform
  1. Windows
"C:\Users\User1\Dropbox\z_sync_do_not_delete\Downloads\DataGridExport.xlsx"

The user is the same?
 

dwool40

New Member
Joined
Apr 27, 2018
Messages
29
"C:\Users\User1\Dropbox\z_sync_do_not_delete\Downloads\DataGridExport.xlsx"

The user is the same?
Yes. All 3 macros have the same path to the downloads folder. The Copynotice and CopyUA macros work fine. The Downloads macro (same path) returns the 53 error.
 

EdNerd

Active Member
Joined
May 19, 2011
Messages
418
Have you tried specifically naming the files to delete, instead of using *.*?
Does that computer have Delete permissions in that folder?
 

dwool40

New Member
Joined
Apr 27, 2018
Messages
29

ADVERTISEMENT

Have you tried specifically naming the files to delete, instead of using *.*?
Does that computer have Delete permissions in that folder?
It does have delete permissions. It's the Downloads folder.
 

dwool40

New Member
Joined
Apr 27, 2018
Messages
29
I switched *.* to *.xl* to get the result I needed. It's a newer computer so IT must have changed permissions.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,241
Messages
5,836,193
Members
430,406
Latest member
pmav

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
Top