VBA Help with out or Range error

willow1985

Well-known Member
Joined
Jul 24, 2019
Messages
888
Office Version
  1. 365
Platform
  1. Windows
I have a macro that works on multiple other computers with the exception of one. I get a script out of range error on this one computer and I cannot figure out why. It appears the drives/folder locations are named all the same (it is a network shared drive)

The Source_File = line is where I am getting the error.

Any ideas as to what could be the problem would be greatly appreciated.

VBA Code:
Private Sub Transfer_CC()
Dim FSO
Dim Source_File As String
Dim Source_Folder As String
Dim Destination_Folder As String

Source_File = Workbooks("Customer Concern - Warranty Request Log").Sheets("List").Range("M1").Value & ".xls"
Source_Folder = "X:\QUALITY\Quality Assurance\Group\Corrective Actions\Customer Concerns - Corrective Action\"
Destination_Folder = Workbooks("Customer Concern - Warranty Request Log").Sheets("List").Range("I5")
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile (Source_Folder & Source_File), Destination_Folder, True
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Try adding the file extension to the workbook name.
 
Upvote 0
Solution
Try adding the file extension to the workbook name.
Sorry, how would I modify the Source_File line with the file extension?
The file extension is: X:\QUALITY\Quality Assurance\Group\Corrective Actions\
 
Upvote 0
You need to do it for the workbook name like
Rich (BB code):
Source_File = Workbooks("Customer Concern - Warranty Request Log.xlsx").Sheets("List").Range("M1").Value & ".xls"
Change the bit in red to reflect the actual file extension.
 
Upvote 0
You're welcome & thanks for the feedback.

If a user has folder settings set to "Hide extensions for known file types" then you don't need the extension, but if that setting is unchecked you need the extension.
 
Upvote 0
You're welcome & thanks for the feedback.

If a user has folder settings set to "Hide extensions for known file types" then you don't need the extension, but if that setting is unchecked you need the extension.
Good to know! that is most likely what is happening. I will keep that in mind. Thank you again :)
 
Upvote 0
You're welcome & thanks for the feedback.
It's always best to include the extension, that way your safe. :)
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,352
Members
449,080
Latest member
Armadillos

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