VBA Path Issue

dwool40

New Member
Joined
Apr 27, 2018
Messages
46
Office Version
  1. 365
Platform
  1. Windows
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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
"C:\Users\User1\Dropbox\z_sync_do_not_delete\Downloads\DataGridExport.xlsx"

The user is the same?
 
Upvote 0
"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.
 
Upvote 0
Have you tried specifically naming the files to delete, instead of using *.*?
Does that computer have Delete permissions in that folder?
 
Upvote 0
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.
 
Upvote 0
I switched *.* to *.xl* to get the result I needed. It's a newer computer so IT must have changed permissions.
 
Upvote 0

Forum statistics

Threads
1,217,476
Messages
6,136,870
Members
450,028
Latest member
CHlEFS47

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