Quantcast
Channel: #NAME? error in Excel for VBA Function - Stack Overflow
Viewing all articles
Browse latest Browse all 14

Answer by Hans-Gerhard Schehl for #NAME? error in Excel for VBA Function

$
0
0

This solution applies to users with an Excel installed in another language than "United States English":I had a similar problem when making a copy of the active workbook to duplicate it and immediately opened the copy afterwards:

Non-working code:

   ThisWorkbook.SaveCopyAs NewFileName   Set wb = Workbooks.Open(FileName:=NewFileName)

This always showed me several cells with Error 2029 / "#NAME?". If I opened the Workbook "the official way" via the File-Menu it worked as expected.

I solved the issue by adding the parameter "local:=true" to the open statement:

Working code:

   ThisWorkbook.SaveCopyAs NewFileName   Set wb = Workbooks.Open(FileName:=NewFileName, Local:=True)

as VBA expected english function names in my German workbook. With this parameter VBA is told directly to use the local names.

I hope that helps someone not to loose several hours, as I did...


Viewing all articles
Browse latest Browse all 14

Trending Articles