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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

StephenCrump

MrExcel MVP
Joined
Sep 18, 2013
Messages
4,731
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?
 
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,167,531
Messages
5,854,284
Members
431,636
Latest member
shabbas313

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