Excel vba bad file name or number

Permalink

Cannot retrieve contributors at this time

title keywords f1_keywords ms.prod ms.assetid ms.date ms.localizationpriority

Bad file name or number (Error 52)

vblr6.chm1000052

vblr6.chm1000052

office

9318e732-9cba-c4ec-2108-8147b34e0847

06/08/2017

high

An error occurred trying to access the specified file. This error has the following causes and solutions:

  • A statement refers to a file with a file number or file name that is:

    • Not specified in the Open statement or was specified in an Open statement, but has since been closed. Specify the file name in an Open statement. Note that if you invoked the Close statement without arguments, you may have inadvertently closed all currently open files, invalidating all file numbers.

    • Out of the range of file numbers (1 — 511). If your code is generating file numbers algorithmically, make sure the numbers are valid.

  • There is an invalid name or number.

        LETTER.DOC 
      My Memo.Txt 
      BUDGET.92 
      12345678.901 
      Second Try.Rpt 
    

    File names must conform to operating system conventions as well as Basic file-naming conventions.

    In Microsoft Windows, use the following conventions for naming files and directories:

    • The name of a file or directory can have two parts: a name and an optional extension. The two parts are separated by a period, for example, myfile.new.

    • The name can contain up to 255 characters.

    • The name must start with either a letter or number. It can contain any uppercase or lowercase characters (file names aren’t case-sensitive) except the following characters: quotation mark («), apostrophe (), slash (/), backslash (**), colon (:), and vertical bar (|**).

    • The name can contain spaces.

    • The following names are reserved and can’t be used for files or directories: CON, AUX, COM1, COM2, COM3, COM4, LPT1, LPT2, LPT3, PRN, and NUL. For example, if you try to name a file PRN in an Open statement, the default printer will simply become the destination for Print # and Write # statements directed to the file number specified in the Open statement.

    • On the Macintosh, a file name can include any character except the colon (:), and can contain spaces. Null characters (Chr(0)) aren’t allowed in any file names.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

[!includeSupport and feedback]

I am attempting to run vba code to perform a number of operations on a folder of excel files. This code had been written by someone else no longer with my company, but the VBA script worked when last run. Now, when I attempt to run it, I keep getting run time error 52 («Bad file name or number»). Any suggestions?

The code is much longer, but the error (per the debugger) highlights as such:

Print #intFreeFile, _
" *XXXXXXXXX * * * Error in code 'main_ProcessBringFwd' " & Err & ": " & _
Error(Err)

Community's user avatar

asked Jul 31, 2014 at 16:21

New_to_VBA's user avatar

3

The problem is probably this one told by the error message.
Open the code and look for commands trying to read or save files. They are probably using an invalid path.

Somewhere in your code you might have something like this:

Open file_name For Output As #intFreeFile

Debug your code and check if the value in «file_name» (it may be other var name) is a valid path and also a valid file name.

answered Jul 31, 2014 at 16:28

Caffé's user avatar

CafféCaffé

1,1611 gold badge9 silver badges19 bronze badges

If the file is a network file then the program may not be able to find the file if there is a temporary network failure, I have ran into this issue several times.

The fix to this type of error is to check that the drive / folder exists before opening the file.

answered May 9, 2019 at 14:36

code-it's user avatar

This can happen if the target directory does not exist, or you don’t have write access

answered Jul 9, 2020 at 0:38

Stuff Happens's user avatar

I found out that when I got this error message, it was because I was trying to use a : in the name of the file. As soon as I removed it, the macro ran perfectly. I think there may be a conflict with the code when it comes to special characters.

Kurt Van den Branden's user avatar

answered Nov 7, 2016 at 7:29

Steven Cohen's user avatar

0

Hi Guys I was getting the same error when trying to run Excel Tool that has a Marco to add a Zip File. On a OneDrive sync folder.
-Dont know if this are the cases you guys are getting but there is a Feature in OneDrive that you must either disable or run the files outside a sync folder that OneDrive is not using…
-Under OneDrive Settings go to «Office» Tab and uncheck «Use Office Applications to Sync Office Files that I Open»enter image description here

answered Aug 12, 2021 at 15:28

user16651568's user avatar

  • Remove From My Forums
  • Вопрос

  • Здравствуйте.

    Проблема следующая.

    При открытии файла excel в пользовательском приложении (office 2010), из библиотеки документов, появляется ошибка «Run-time error ’52’ Bad file name or number». Если этот же документ открываю в office 2013, все открывается
    и для чтения и для редактирования без ошибок.

    Версия SharePoint 2013 Standart.

    Что делать и как устранить ошибку, не знаю. Поэтому прошу помощи у вас, возможно кто то уже сталкивался с этой проблемой.

Ответы

  • Всем большое спасибо. Я разобрался.

    Проблема была в интеграторе с приложением Directum, которая использовала макрос VBA. 

    Огромная всем благодарность, что не остались в стороне. 

    • Помечено в качестве ответа

      29 октября 2014 г. 11:44

Sometimes, your system may display a message that the runtime error 52 is an invalid file name or Excel VBA number. This problem can be caused by a number of reasons.

Recommended

  • 1. Download ASR Pro
  • 2. Follow the on-screen instructions to run a scan
  • 3. Restart your computer and wait for it to finish running the scan, then follow the on-screen instructions again to remove any viruses found by scanning your computer with ASR Pro
  • Speed up your PC today with this easy-to-use download.

    An error occurred while accessing the specified file. An instruction refers to a manual entry with a file number or instruction name that: was not specified in an Open instruction or was selected in an Open instruction but has since been closed.

    • 2 minutes to read.

    In Aria-label = “article Here Article

    How do I fix runtime Error 52 in Excel?

    Error collecting the specified File. This error has the following causes and solutions:

    • The article refers to a file with a very file number or file name, the idea is this:

      • Not specified in open fact or was specified in open statement, but has since been done. Specify the file name in 1 Open statement. Note that if you called Close with no arguments , most users could accidentally close all open files and invalidate all folder numbers.

      • The number of files is out of range (1-511). When your password algorithmically generates a numbers file to make sure the numbers are valid.

    • Invalid name or number.

        BREF.DOC  My Memo.Txt  BUDGET 92  12345678901  Second try. 

      File names must follow the operating system and basic file naming conventions.

      Use correct naming conventions for directories and documents on Microsoft Windows:

      • A file or folder name can have two parts: a detail and an optional extension. The two parts are separated by duration, e.g. mer myfile.new.

      • How do I fix Visual Basic runtime error?

        The name can be up to 255 characters long.

      • The name must start with a letter or number. It can contain any type of uppercase or lowercase letter (filenames are not case sensitive), except for the following characters: premium character (“), apostrophe (‘), abbreviation (/), backslash (* *), colon ( :), and an up-down bar (| **).

      • The name can contain spaces.

      • The following names are reserved and cannot be used for files or directory pages: CON, AUX, COM1, COM2, COM3, COM4, ​​LPT1, LPT2, LPT3, PRN, and NO. For example, if you try to name a PRN file in a better Open statement, the default printer can simply target the recommended Print # and Write # statements for the specified file number by executing the Open statement.

      • Why do I get run time error 52 in VBA?

        On Macintosh, the name can contain anything other than a colon (:), and in many cases it can contain spaces. Null characters (Chr (0)) are not allowed in filenames.

    For other other information, select an item in meditation press and F1 (on Windows), also called HELP (on Macintosh).

    Support In Addition To Feedback

    You areHave any questions or comments about Office VBA or this documentation? For information on how to get help and provide feedback, see Office Support and Feedback for VBA.

    runtime error 52 bad filename or number excel vba

    I am trying to run vba runtime code to perform a bunch of folder operations related to Excel files. This code was already written by someone else who no longer worked for my company, but the VBA script worked the last time it was run. With this in mind, every time I try to boot, I always get a 52x error (“Invalid file name with number”). Offers ?

    The code is very long, but the error (depending on the specific debugger) is highlighted like this:

    Print #intFreeFile, _ "* XXXXXXXXX 7. * Error * in the directives main_ProcessBringFwd" & Err & Zoll: "& _ Error (Err)

    requested on Jul 31, 14 @ 4:21 pm

    How do I fix Visual Basic error in Excel?

    31

    Are You Looking For The Wrong Answer? Explore Other Queries With The Vba Tagged Excel Runtime Or Ask Your Own Question.

    The problem is undoubtedly explained by the entire error message.Open the code and look inside the commands trying to read the files. You are probably going the right wrong way.

      Open filename for output as #intFreeFile 

    Debug your code and check if the value in “file_name” (it could be a different var name) is actually a valid path and a matching file name.

    picked up on July 31, 2014 at 16:28.

    1061

    If the initiator is a network file and the program might not find the file, if it is definitely a temporary network error, I have encountered this problem several times before.

    The fix for this type of error might be to check for the existence of the get / folder before opening a new file.

    answered May 9 ’19 at 14:36

    This can happen if some target directory does not exist and even if you do not have write access

    may have received a reply at 12:38 pm on July 9th.

    I discovered this when I got a specific error message because perhaps I am trying to use : on the filename. Once I removed it, the macro worked fine. I think there may be a conflict with most of the code regarding some symbols.

    What does bad file name or number mean?

    answered Nov 3, 2016 at 7:29 am

    Recommended

    Is your PC running slow? Do you have problems starting up Windows? Don’t despair! ASR Pro is the solution for you. This powerful and easy-to-use tool will diagnose and repair your PC, increasing system performance, optimizing memory, and improving security in the process. So don’t wait — download ASR Pro today!

  • 1. Download ASR Pro
  • 2. Follow the on-screen instructions to run a scan
  • 3. Restart your computer and wait for it to finish running the scan, then follow the on-screen instructions again to remove any viruses found by scanning your computer with ASR Pro
  • Hi guys, I got the same error when trying to successfully run an Excel tool that has some kind of mark for adding a zip file. In the OneDrive sync folder.- I don’t know if this is the case, but usually OneDrive has a feature that most users need to disable or run exact files outside of the sync folder since OneDrive is not used.- Perego to the Office tab in OneDrive preferences to uncheck “Use Office apps to sync Office files I open”, enter your image information here

    answered Aug 16 at 15:28 in

    runtime error 52 bad filename or number excel vba

    Speed up your PC today with this easy-to-use download.

    How do I fix Visual Basic runtime error?

    Start Microsoft Excel.From the menu bar, select File> [Excel] Options> Trust Center> Trust Center Options> Macro Options.At the top, select the important switch “Disable all macros for notifications.”

    How do I fix Visual Basic error in Excel?

    Open a blank workbook in Excel.Go to File> Options> Trust Center.Click Trust Center Settings.In the Macro Options section, ensure that reliable access to the VBA project theme template is enabled.

    How do I fix a runtime error in Excel?

    To solve this problem, unprotect the sheet from running the macro. You can manually unprotect a sheet using the Unprotect method for a macro.

    I just figured this out. We use a program called Worldox. It is a document management system. It uses macros that aren’t listed  when you search for them within excel. Even if you disable all macros it seems to still affect things. There is an add-in that some of our attorneys use which allows them to save documents directly to the Worldox system. In order to remove that I had to go to usernameAppDataRoamingMicrosoftExcelXLSTART  and remove the .DOTM file, which is a macros enabled template.  After deleting this file and restarting Excel the error no longer pops up.


    Was this post helpful?
    thumb_up
    thumb_down

    • #2

    I can’t replicate this error. What’s the actual pattern argument to Dir?

    • #3

    I’ve never seen this error either — DIR returns empty strings when I give it non-existent files. Maybe there’s something very odd in your directory itself.

    The FSO object is pretty flexible and reliable:

    Code:

    Dim FSO as Object '//FileSystemObject
    Dim f as Object '//File Object
    
    SET FSO = CreateObject("Scripting.FileSystemObject")
    With FSO
        If .FolderExists("C:myFolder") Then
            For each f in .GetFolder("C:myFolder").Files
                Debug.Print f.Path
            Next f 
        End If
    End With

    yky

    Well-known Member


    • #4

    Thanks for the replies.

    In my case, if the file resides on a network drive and the drive is not found, I get the error message «bad file name of number.» The actual code is this:

    if dir(«\vaioflowerflower sales report», vbdirectory») <> «» then

    elseif dir(«\lenovoflowerflower sales report», vbdirectory» <> «» then

    I have a laptop and a desktop. I need this code to work on both computers. If both computers are on and on the same network, the code works fine. If I’m away from the desktop or if I run the code from the desktop while the laptop is not turned on, I get the error message. (Just tested it again. When laptop was on, the code worked fine. I then turned the laptop off and got the error message.)

    I searched google and found other people having encountered the same error message also when executing DIR.

    yky

    Well-known Member


    • #5

    Just want to add that in the debug window, both «dir(«\vaioflowerflower sales report», vbdirectory») <> «»» and «iserror(dir(«\vaioflowerflower sales report», vbdirectory») <> «»)» show the exact same message: <bad file name or number>.

    • #6

    From the point of view of your code, I would just add a preliminary test:

    Code:

    If dir() = "bad file blah blah" then
       '//Don't try anymore
    Else
       '//Do my Dir() thing

    yky

    Well-known Member


    • #7

    Thanks for the suggestion.

    I tried it and still got the same error message «bad file name or number.» Looks to me when the error occurs Excel throws out the error message and stops there.

    • #8

    I’m not 100% sure that DIR works at all with unc file paths (it doesn’t when I try using it on a local network share). I’m not an expert in this area — I typically use the FSO object for such things, so I can give that as an alternate solution (here I created a function that returns a collection with the file paths from the files in the folder):

    Code:

    [COLOR="Navy"]Sub[/COLOR] TestIt()
    [COLOR="Navy"]Dim[/COLOR] col [COLOR="Navy"]As[/COLOR] VBA.Collection
    [COLOR="Navy"]Dim[/COLOR] i [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
    
        [COLOR="Navy"]Set[/COLOR] col = GetFiles()
        [COLOR="Navy"]If[/COLOR] [COLOR="Navy"]Not[/COLOR] col [COLOR="Navy"]Is[/COLOR] [COLOR="Navy"]Nothing[/COLOR] [COLOR="Navy"]Then[/COLOR]
            [COLOR="Navy"]For[/COLOR] i = 1 [COLOR="Navy"]To[/COLOR] col.Count [COLOR="SeaGreen"]'//vba collections are 1-based[/COLOR]
                [COLOR="Navy"]Debug[/COLOR].[COLOR="Navy"]Print[/COLOR] col.Item(i)
            [COLOR="Navy"]Next[/COLOR] i
        [COLOR="Navy"]End[/COLOR] [COLOR="Navy"]If[/COLOR]
        
    [COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
    
    
    [COLOR="Navy"]Function[/COLOR] GetFiles() [COLOR="Navy"]As[/COLOR] VBA.Collection
    [COLOR="Navy"]Dim[/COLOR] FSO [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Object[/COLOR] [COLOR="SeaGreen"]'FileSystemObject[/COLOR]
    [COLOR="Navy"]Dim[/COLOR] fldr [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Object[/COLOR] [COLOR="SeaGreen"]'Folder[/COLOR]
    [COLOR="Navy"]Dim[/COLOR] f [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Object[/COLOR] [COLOR="SeaGreen"]'File[/COLOR]
        
        [COLOR="Navy"]On[/COLOR] [COLOR="Navy"]Error[/COLOR] [COLOR="Navy"]Resume[/COLOR] [COLOR="Navy"]Next[/COLOR]
        [COLOR="Navy"]Set[/COLOR] FSO = CreateObject("Scripting.FileSystemObject")
        [COLOR="Navy"]With[/COLOR] FSO
            
            [COLOR="SeaGreen"]'//Get folder on network share[/COLOR]
            [COLOR="Navy"]If[/COLOR] .FolderExists("\CorpfsacctgPPE") [COLOR="Navy"]Then[/COLOR]
                [COLOR="Navy"]Set[/COLOR] fldr = .GetFolder("\CorpfsacctgPPE")
            
            [COLOR="SeaGreen"]'//If unavailable then try local folder on X:[/COLOR]
            [COLOR="Navy"]ElseIf[/COLOR] .FolderExists("X:PPE") [COLOR="Navy"]Then[/COLOR]
                [COLOR="Navy"]Set[/COLOR] fldr = .GetFolder("X:PPE")
            
            [COLOR="Navy"]End[/COLOR] [COLOR="Navy"]If[/COLOR]
                
            [COLOR="SeaGreen"]'//Add file paths to collection object[/COLOR]
            [COLOR="Navy"]If[/COLOR] [COLOR="Navy"]Not[/COLOR] fldr [COLOR="Navy"]Is[/COLOR] [COLOR="Navy"]Nothing[/COLOR] [COLOR="Navy"]Then[/COLOR]
                [COLOR="Navy"]If[/COLOR] fldr.Files.Count > 0 [COLOR="Navy"]Then[/COLOR]
                    [COLOR="Navy"]Set[/COLOR] GetFiles = [COLOR="Navy"]New[/COLOR] VBA.Collection
                    [COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] f [COLOR="Navy"]In[/COLOR] fldr.Files
                        GetFiles.Add f.Path
                    [COLOR="Navy"]Next[/COLOR] f
                [COLOR="Navy"]End[/COLOR] [COLOR="Navy"]If[/COLOR]
            [COLOR="Navy"]End[/COLOR] [COLOR="Navy"]If[/COLOR]
        
        [COLOR="Navy"]End[/COLOR] [COLOR="Navy"]With[/COLOR]
    
        
    [COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Function[/COLOR]

    • #9

    So Excel is raising an error, that is, displaying an error message in a dialog while suspending macro execution? If so, try error trapping.

    Code:

    On Error Resume Next
    stringvariable = ""
    stringvariable = Dir("\alonguncpath", vbDirectory)
    If Err.Number <> 0 Then
      'effectively invalid unc server, take whatever action you deem appropriate
      Err.Clear
    End If
    If stringvariable <> "" Then
      'found the directory, so do what you need to do
    End If

    • #10

    I can’t get Dir() to work with a UNC file path in VBA. Maybe VBA can’t handle this job (?).

    I.e., at the command prompt:
    DIR \CorpfsACCTG —> works

    in VBA
    Dir («\CorpfsACCTG») —> bad file name or number

    So if the share exists but Dir can’t find it in VBA then we can’t use Dir() for this job.

    Содержание

    1. Bad file name or number (Error 52)
    2. Support and feedback
    3. Недопустимое имя файла или номер (ошибка 52)
    4. Поддержка и обратная связь
    5. Run time error 52 bad file name or number excel
    6. Вопрос
    7. Ответы
    8. Все ответы
    9. Run time error 52 bad file name or number excel
    10. Вопрос
    11. Ответы
    12. Все ответы
    13. Thread: [RESOLVED] «Run time error ’52’: Bad file name or number» when i open associated text file
    14. [RESOLVED] «Run time error ’52’: Bad file name or number» when i open associated text file
    15. Re: «Run time error ’52’: Bad file name or number» when i open associated text file
    16. Re: «Run time error ’52’: Bad file name or number» when i open associated text file
    17. Re: «Run time error ’52’: Bad file name or number» when i open associated text file
    18. Re: «Run time error ’52’: Bad file name or number» when i open associated text file
    19. Re: «Run time error ’52’: Bad file name or number» when i open associated text file
    20. Re: «Run time error ’52’: Bad file name or number» when i open associated text file
    21. Re: «Run time error ’52’: Bad file name or number» when i open associated text file
    22. Re: «Run time error ’52’: Bad file name or number» when i open associated text file
    23. Re: «Run time error ’52’: Bad file name or number» when i open associated text file
    24. Posting Permissions

    Bad file name or number (Error 52)

    An error occurred trying to access the specified file. This error has the following causes and solutions:

    A statement refers to a file with a file number or file name that is:

    Not specified in the Open statement or was specified in an Open statement, but has since been closed. Specify the file name in an Open statement. Note that if you invoked the Close statement without arguments, you may have inadvertently closed all currently open files, invalidating all file numbers.

    Out of the range of file numbers (1 — 511). If your code is generating file numbers algorithmically, make sure the numbers are valid.

    There is an invalid name or number.

    File names must conform to operating system conventions as well as Basic file-naming conventions.

    In Microsoft Windows, use the following conventions for naming files and directories:

    The name of a file or directory can have two parts: a name and an optional extension. The two parts are separated by a period, for example, myfile.new.

    The name can contain up to 255 characters.

    The name must start with either a letter or number. It can contain any uppercase or lowercase characters (file names aren’t case-sensitive) except the following characters: quotation mark («), apostrophe (), slash (/), backslash (**), colon (:), and vertical bar (|**).

    The name can contain spaces.

    The following names are reserved and can’t be used for files or directories: CON, AUX, COM1, COM2, COM3, COM4, LPT1, LPT2, LPT3, PRN, and NUL. For example, if you try to name a file PRN in an Open statement, the default printer will simply become the destination for Print # and Write # statements directed to the file number specified in the Open statement.

    On the Macintosh, a file name can include any character except the colon (:), and can contain spaces. Null characters (Chr(0)) aren’t allowed in any file names.

    For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

    Support and feedback

    Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

    Источник

    Недопустимое имя файла или номер (ошибка 52)

    При попытке доступа к заданному файлу возникла ошибка. Эта ошибка имеет следующие причины и способы решения:

    Оператор ссылается на файл с номером файла или именем файла, которые:

    Не определены в операторе Open либо был определен в операторе Open, но с тех пор закрыт. Укажите имя файла в операторе Open. Обратите внимание, что если оператор Close выполнить без аргументов, возможно, все открытые в текущий момент файлы будут ненамеренно закрыты, тем самым сделав недействительными все номера файлов.

    За пределами диапазона номеров файлов (1–511). Если кодом генерируются номера файлов по алгоритму, убедитесь, что номера являются допустимыми.

    Существует недопустимое имя или недействительный номер.

    Имена файлов должны соответствовать соглашениям, принятым в операционной системе, а также соглашениям по именованию файлов в языке Basic.

    В Microsoft Windows используются следующие соглашения по именованию файлов и каталогов:

    Имя файла или каталога может состоять из двух частей: имени и необязательного расширения. Две части разделяются точкой, например, myfile.new.

    Имя может содержать до 255 знаков включительно.

    Имя должно начинаться с буквы или цифры. Он может содержать любые символы в верхнем или нижнем регистре (в именах файлов не учитывается регистр), за исключением следующих символов: кавычки («), апострофа (), косой черты (/), обратной косой черты (**), двоеточия (:) и вертикальной полосы (|**).

    Имя может содержать пробелы.

    Следующие имена зарезервированы и не могут использоваться для файлов и каталогов: CON, AUX, COM1, COM2, COM3, COM4, LPT1, LPT2, LPT3, PRN и NUL. Например, если попытаться присвоить файлу имя PRN в операторе Open, принтер по умолчанию просто станет адресатом для операторов Print # и Write #, направляемых в номер файла, который указывается в операторе Open.

    На компьютерах Macintosh имя файла может включать любой знак за исключением двоеточия (:), а также может содержать пробелы. Использование символов Null (Chr(0)) в именах файлов не допускается.

    Для получения дополнительной информации выберите необходимый элемент и нажмите клавишу F1 (для Windows) или HELP (для Macintosh).

    Поддержка и обратная связь

    Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь.

    Источник

    Run time error 52 bad file name or number excel

    Вопрос

    При открытии файла excel в пользовательском приложении (office 2010), из библиотеки документов, появляется ошибка «Run-time error ’52’ Bad file name or number». Если этот же документ открываю в office 2013, все открывается и для чтения и для редактирования без ошибок.

    Версия SharePoint 2013 Standart.

    Что делать и как устранить ошибку, не знаю. Поэтому прошу помощи у вас, возможно кто то уже сталкивался с этой проблемой.

    Ответы

    Всем большое спасибо. Я разобрался.

    Проблема была в интеграторе с приложением Directum, которая использовала макрос VBA.

    Огромная всем благодарность, что не остались в стороне.

    • Помечено в качестве ответа Иван Проданов Microsoft contingent staff, Moderator 29 октября 2014 г. 11:44

    Все ответы

    проблема у всех пользователей или только у конкретных?

    Судя по симптомам проблем, затруднения НЕ на стороне в Sharepoint.

    Ошибка 52 появляется, чтобы предупредить вас, что ваш компьютер имеет некорректное имя или некорректный файл где-то в его системе, и, как следствие, он не может запустить файл. Эта ошибка является результатом проблемы с приложением в системе. Вы, как правило, эта ошибка в документах Microsoft Excel, которые были сделаны с использованием другого компьютера . ТАк же, нельзя исключать, что ошибка может быть вызвана макросами, используемыми в файле.

    1. Зайти в панель управления, пользовательского ПК, и в меню удаления программ — восстановить пакет офис
    (тут)
    2. Проверьте наличие макросов в документе
    3. Проверить/почистить реестр, так как возможно один из секторов позволяет генерировать эти ошибки
    (тут подробности)

    (если я правильно понял у нас на клиенском пк установлены 2 версии пакетов офис?)

    Источник

    Run time error 52 bad file name or number excel

    Вопрос

    При открытии файла excel в пользовательском приложении (office 2010), из библиотеки документов, появляется ошибка «Run-time error ’52’ Bad file name or number». Если этот же документ открываю в office 2013, все открывается и для чтения и для редактирования без ошибок.

    Версия SharePoint 2013 Standart.

    Что делать и как устранить ошибку, не знаю. Поэтому прошу помощи у вас, возможно кто то уже сталкивался с этой проблемой.

    Ответы

    Всем большое спасибо. Я разобрался.

    Проблема была в интеграторе с приложением Directum, которая использовала макрос VBA.

    Огромная всем благодарность, что не остались в стороне.

    • Помечено в качестве ответа Иван Проданов Microsoft contingent staff, Moderator 29 октября 2014 г. 11:44

    Все ответы

    проблема у всех пользователей или только у конкретных?

    Судя по симптомам проблем, затруднения НЕ на стороне в Sharepoint.

    Ошибка 52 появляется, чтобы предупредить вас, что ваш компьютер имеет некорректное имя или некорректный файл где-то в его системе, и, как следствие, он не может запустить файл. Эта ошибка является результатом проблемы с приложением в системе. Вы, как правило, эта ошибка в документах Microsoft Excel, которые были сделаны с использованием другого компьютера . ТАк же, нельзя исключать, что ошибка может быть вызвана макросами, используемыми в файле.

    1. Зайти в панель управления, пользовательского ПК, и в меню удаления программ — восстановить пакет офис
    (тут)
    2. Проверьте наличие макросов в документе
    3. Проверить/почистить реестр, так как возможно один из секторов позволяет генерировать эти ошибки
    (тут подробности)

    (если я правильно понял у нас на клиенском пк установлены 2 версии пакетов офис?)

    Источник

    Thread: [RESOLVED] «Run time error ’52’: Bad file name or number» when i open associated text file

    Thread Tools
    Display

    [RESOLVED] «Run time error ’52’: Bad file name or number» when i open associated text file

    i am getting error «Run time error ’52’: Bad file name or number» when i use this code to open a text file that is accociated with my app.

    File association is set up using inno.

    when i replace Command$ with «C:UsersDaveDocumentsdave.cppl» and run it in design mode there is no error.

    Re: «Run time error ’52’: Bad file name or number» when i open associated text file

    What does Command$ return?
    Place break pointer right on that line and you will see the actual value.
    Or you can at least print value to debug (Debug.Print DoubleClickedFile).

    Re: «Run time error ’52’: Bad file name or number» when i open associated text file

    DoubleClickedFile = Mid(DoubleClickedFile, 4, Len(DoubleClickedFile) — 3)
    returns this: UsersDaveDocumentsdave.cppl»

    and DoubleClickedFile returns this: «C:UsersDaveDocumentsdave.cppl»

    i was trying to remove the drive letter but did nit remove the right side quote marks.

    Does the drive letter need to be removed of this to work?

    Re: «Run time error ’52’: Bad file name or number» when i open associated text file

    Why are you trying to remove the drive letter?

    That is an important part of the file location, and as you are opening the file you want to know the full file location.

    Re: «Run time error ’52’: Bad file name or number» when i open associated text file

    I saw the same problem posted elswhere in google and the solution was to remove the drive letter. but this does not work.

    Re: «Run time error ’52’: Bad file name or number» when i open associated text file

    Path must be valid (or complete) or you will get an error.
    Solution from that Google search could’ve related to a different problem though.

    Re: «Run time error ’52’: Bad file name or number» when i open associated text file

    I can’t think of any situation like this where removing the drive letter would be a good thing.

    Does Command$ actually contain the » character at the start and end?

    If so, this should solve it:

    Re: «Run time error ’52’: Bad file name or number» when i open associated text file

    this code returns this: «C:UsersDaveDocumentsdave.cppl» in text1.text

    either way i get «Run time error ’52’: Bad file name or number» when i remove «on error resume next»

    Re: «Run time error ’52’: Bad file name or number» when i open associated text file

    Re: «Run time error ’52’: Bad file name or number» when i open associated text file

    so my problem was quotes around the file and path.
    Thanks, this works.

    • VBForums
    • Visual Basic
    • Visual Basic 6 and Earlier
    • [RESOLVED] «Run time error ’52’: Bad file name or number» when i open associated text file

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    • BB code is On
    • Smilies are On
    • [IMG] code is On
    • [VIDEO] code is On
    • HTML code is Off

    Click Here to Expand Forum to Full Width

    Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.

    Источник

    Понравилась статья? Поделить с друзьями:
  • Excel vba change all cells
  • Excel vba autofilter criteria not
  • Excel vba cells value get value
  • Excel vba autofilter array
  • Excel vba cells not empty