Values from closed WB requires I manually select path from dialog box?

TTom

Well-known Member
Joined
Jan 19, 2005
Messages
518
I've used the code (below) successfully in other workbooks, but now I am getting a message when code reaches:
.FormulaArray = ArrayPath
that opens a dialog box requesting I select the path and wb the array path is set to use.

The weird thing is I used the code in an existing program and my new program with the exact same array path, the old one works fine - no dialog box - the new program requires I path to the wb? I looked at both codes and I can not find difference. Any idea what I am missing, may disabling alerts (although I don't see that in the code that works w/o dialog?)
<code>
ArrayPath = "='" & FilePath & "[" & FileName & "]" & SheetN & "'!K31:O32" '2rx5c array
Cells(Range("A65000").End(xlUp).Row + 1, 1).Activate
rr = ActiveCell.Row
cc = ActiveCell.Column
Set DestRange = Sheets("Sheet4").Range(Cells(rr, cc), Cells(rr + 1, cc + 4)) '2rx5c array
Application.Goto DestRange
With DestRange
.FormulaArray = ArrayPath
.Copy
.PasteSpecial xlPasteValues
.Cells(1).Select
.PasteSpecial xlPasteValues
Application.CutCopyMode = False
End With
</code>
 

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".

StephenCrump

MrExcel MVP
Joined
Sep 18, 2013
Messages
4,124
Office Version
  1. 365
Platform
  1. Windows
The syntax is fine. The reason you're getting the dialog box is that when you set ArrayPath in the following line, FilePath and/or FileName don't exist:

<code>ArrayPath = "='" & FilePath & "[" & FileName & "]" & SheetN & "'!K31:O32"</code>

I suggest you put a break point on this line and check the ArrayPath string, e.g. is there a typo in FileName?
 

Watch MrExcel Video

Forum statistics

Threads
1,130,447
Messages
5,642,209
Members
417,262
Latest member
andrewd1

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