Microsoft Visual Basic Runtime Error 4160
Contents |
your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select microsoft access bad filename or number the forum that you want to visit from the selection below. Results 1 to
Bad Filename Or Number Access Import
2 of 2 Thread: Runtime Error 4160 Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid bad filename or number vba Mode Switch to Threaded Mode Oct 2nd, 2003,08:34 AM #1 Wafflehose View Profile View Forum Posts Visit Homepage Thread Starter Banned Join Date Apr 2001 Location Quantico, VA Posts 34 Runtime Error 4160 I'm a programmer
Access 2010 Bad Filename Or Number
on a USMC Inspection program, and this error is killing me. I just had a laptop delivered from the Pentagon, with the instructions saying "Cpl Miller, Please fix this. I need it by Friday. I'm getting error 4160. Thanks, MajGen T" This is a scary man, and I want to try and get this for him. What's happening is when the program pulls up Word so the user can edit comments on a specific bad filename or number vbscript part on an inspection. He's doing this for about 20 minutes, adding and editing comments, when the error appears and bombs out of the program, causing him to lose all work. He's a little upset because he's having to save after every edit. Only problem, I have been TRYING to duplicate the problem for almost an hour, and haven't gotten anything. It's hard to get better details from him, because he "doesn't remember what he did when it happened". Anyone know about this error??? Reply With Quote Oct 2nd, 2003,09:00 AM #2 jim mcnamara View Profile View Forum Posts Frenzied Member Join Date Jul 2002 Posts 1,370 Error code 4160 relates to a bad file name when automating Word. Also this error is caused by a problem with the templates not being properly attached to the Microsoft Word .DOC file in your project. Reply With Quote Quick Navigation Visual Basic 6 and Earlier Top Site Areas Settings Private Messages Subscriptions Who's Online Search Forums Forums Home Forums Visual Basic Visual Basic .NET VB.net CodeBank Visual Basic 6 and Earlier CodeBank - Visual Basic 6 and earlier Modern Windows Experience (Metro) Office Development Mobile Development ASP, VB Script Database Development Reporting API Games and Graphics Programming Game Demos COM and ActiveX Network Programming Visual Basic FAQs Slow Chat with the Micro
(Русский)ישראל (עברית)المملكة العربية السعودية (العربية)ไทย (ไทย)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語) HomeLibraryLearnDownloadsForums Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Asked by: VBA Runtime Error 4160 "Bad file name"
Runtime Error '4160' Bad File Name
when using Document.fullname as index Microsoft Office for Developers > Word for
Runtime Error 52 Bad Filename Or Number Fix
Developers General discussion 0 Sign in to vote One of my macros runs the following statement: Documents(ThisDocument.FullName).UndoClear (Edit in response to Cindy's first comment below: The actual macro does the UndoClear on a document which is passed as a parameter to the routine which executes it. http://www.vbforums.com/showthread.php?263062-Runtime-Error-4160 I used 'ThisDocument' in the example to provide a simple illustration and means of reproducing the underlying problem). It works fine if ThisDocument is on a local or a network drive, but if on a SkyDrive or SharePoint equivalent (as is the case, for example, on my personal SkyDrive or on the Office 365 that comes with https://social.msdn.microsoft.com/Forums/silverlight/en-US/b1198baa-8be2-4640-ba35-050ba7c6d0a2/vba-runtime-error-4160-bad-file-name-when-using-documentfullname-as-index?forum=worddev my MSDN subscription), it raises a Runtime Error 4160 "Bad File name". The problem can be reproduced as follows: 1. Store a document on SkyDrive that contains the following macro: Sub showProblem() MsgBox "Press OK to continue" Documents(ThisDocument.FullName).UndoClear End Sub 2. Open the document from SkyDrive, and choose to Edit it using your local Word. 3. Run the macro. I have circumvented the problem as follows: 1. A new function finds the numeric index given a FullName: Function BWordGetNumericDocumentIndex(xFullName As String) As Long On Error GoTo notOpen Dim i As Long For i = 1 To Documents.Count If Documents(i).FullName = xFullName Then BWordGetNumericDocumentIndex = i Exit Function End If Next i notOpen: BWordGetNumericDocumentIndex = -1 'in case of failure End Function 2. Where required, replace "Documents(ThisDocument.FullName)" with "Documents(BWordGetNumericDocumentIndex(ThisDocument.FullName))" Although I now have a workaround, I hope Microsoft will update the Documents(index) code to prevent the problem occurring in the first place. Edited by Julian Ladbury Monday, September 02, 2013 3:46 PM clarification Monday, September 02, 2013 2:28 PM Reply | Quot
GoogleВойтиСкрытые поляПоиск групп или сообщений
PMI want to open a Ms word document and update to it. before i open the doc, i need to check whether the doc is open or not. how to check whether the doc/file is open? pls help. thank you. rajeeshun10-25-2004, 09:46 PMUse 'FindFirstFile' API to find whether that file is opened or not. This will enable you to check even hidden files as well deell10-25-2004, 10:19 PMerror occur on the declaration of the function Public Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long Compile error: User-defined type not defined im not familiar with api. i think the error is about the WIN32_FIND_DATA need further help. Thank you webbone10-25-2004, 10:31 PMYou can also use the _lopen API function - on that link is an example 'IsFileShared' that will give you everything you need. deell10-26-2004, 07:50 PMYou can also use the _lopen API function - on that link is an example 'IsFileShared' that will give you everything you need. thanks a lot. the link really help me. now i know how to check the file is already open or not. if the file is already open, i want to close it. how to code this? pls help. Thanks. herilane10-27-2004, 03:10 AMPost #4 here has another, very simple way of checking whether a Word document is already open. Post #3 here shows how you can use GetObject to get hold of an existing instance of Excel; the same approach will apply for Word as well. After that, you just need wdApp.Documents(thatfile).Close deell10-28-2004, 01:08 AMPost #4 here has another, very simple way of checking whether a Word document is already open. Post #3 here shows how you can use GetObject to get hold of an existing instance of Excel; the same approach will apply for Word as well. After that, you just need wdApp.Documents(thatfile).Close the code