Problems running macro on mapped drive

KoolYute

New Member
Joined
Feb 8, 2012
Messages
34
Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
I have a macro that is working fine on my local drive but gives "Error 009 - Subscript out of rage" when it is run via another PC accessing via a mapped drive. The macro is being run from inside the file that is on the line that gives the erro message.
<o:p></o:p>
Sample code:<o:p></o:p>
'**** Open workbooks to transfer temporary data
Workbooks.Open Filename:= _
"G:\CC\Account\2012\Monthly reports\M_Name\Summary\Sup_Name.xls"
Workbooks.Open Filename:= _
"G:\CC\Account\2012\Monthly reports\M_Name\Summary\Temporary_SD.xls"
Windows("Sup_Name.xls").Activate
'Copy and paste the coulmns A,B and C
Sheets("Sheet1").Select
Columns("A:C").Select
Selection.Copy
Windows("Temporary_SD.xls").Activate
Sheets("Temp_RD").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False<o:p></o:p>

****************************************************

<o:p></o:p>
Thanks in advance for your help.<o:p></o:p>
<o:p> </o:p>
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I would suggest not using the mapped network drive letter..
Instead, use the fully qualified network path

Instead of "G:\CC\..."
use "\\Computername\Share\CC\..."

This way, there is no problem with the wrong drive letter mapped on different PC's.
 
Upvote 0

Forum statistics

Threads
1,215,507
Messages
6,125,212
Members
449,214
Latest member
mr_ordinaryboy

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