Error while trying to open .xls files - vba

I have some information in a .xls file (I downloaded it from SAP) and I need to paste it in a .xlsm file.
I'm trying to open that file like always but I have the following error:
Run-time error ‘-2147221080 (800401a8)’:
The file format and extension of ‘file.xls’ don’t match. The file could be corrupted or unsafe. Unless you trust its source, don’t open it. Do you want to open it anyway?
and two options: End and Debug. If I choose debug, I get the following error:
Run-time error ‘-2147221080 (800401a8)’: Automation error
I couldn't find anything in Google. How can I fix it? It's impossible to have the information in another format that is not .xls

Maybe try to open the file with notepad? Notepad can open almost any file. It could be that the content will show strange characters though.

Related

Vba do not open wbook

There isn't enough memory to complete this action" in Excel
How to fix it without opening file
İ want to turn calculation manual but without open it is impossible
In order to change the automatic calculation to manual without opening the .xlsx file, you can do this. Before doing this, be sure to make a copy of the file and try these manipulations on the copy.
Unzip the .xlsx as a .zip archive, open the file ...\xl\workbook.xml in a text editor, find a tag similar to the following <calcPr calcId="191029"/> and add to it calcMode="manual" so you get <calcPr calcId="191029" calcMode="manual"/>. Then save this file, package the entire directory, and change the extension to .xlsx.

Word file corrupts after SaveAs

I've build a program to generate other docm files. The program works just fine without saving the generated files through VBA. When I do save through VBA with a SaveAs statement, however, the generated file becomes corrupt. Trying to open the file gives the following message:
"Could not open the file, there is a problem with the contents."
The SaveAs statement is as follows:
qDoc.SaveAs (getQuizURL(quizname))
The quizUrl function has been thoroughly tested and operates properly.
Does anyone know what's causing this and how to solve it? I could save it all manually, but given that other people will be using this program I'd like it to make it as friendly as possible.
You are missing file format specification.
I am not sure about SaveAs either from your code.
I have got Office -2016 and it has a function called SaveAs2, but may be SaveAs is available in older versions.
Anyhow, change your code to specify the file format.
ThisDocument.SaveAs2 "C:\temp\Test.docm", WdSaveFormat.wdFormatXMLDocumentMacroEnabled
This will do the trick.

How to open a xls file with Excel in VB

So, how can I tell the system to open the file for me? I've tried
Shell(ExcelFilePath)
But an exception was thrown although the file path is from OpenFileDialog.FileOk
So, I am trying to play with Excel.Application, is it possible to open the file with that?
This will open the file with Excel:
Process.Start("EXCEL.EXE", """C:\Folder\file.xls""")
Being the second string the arguments for the process. See the MSDN Dcoumentation.
try this
System.Diagnostics.Process.Start("FilePath")
it will open the file in an application associated with it.

Eclipse PDT .sql always Save As

I have a number of .sql files in my work space, one of them, when I save it always brings up the Save As dialogue, even though it is already saved. The other peculiarness is that there are 3 other files in the same folder that don't have this behaviour, instead they open the systems default editor (GEdit).
When I save the file in question I also get an error message: "Save Failed
org.eclipse.php.internal.ui.editor.RefactorableFileEditorInp ut cannot be cast to org.eclipse.php.internal.ui.editor.input.NonExistingPHPFileE ditorInput "
Can anyone advise where to look for a solution?
After some trial and error: Open with "internal editor" -> text editor solves the problem

Aspell Dictionary can't be opened

When I try to add a word or to ignore all, Aspell throws the error 'the file "C:/Program Files (x86)/Aspell/en.pws" cannot be opened for writing'. Anyone know what is causing this problem and how to fix it?
Ensure that the security settings of the "C:/Program Files (x86)/Aspell" folder for the current user allow for modifying and writing.
I had the same issue, and this cleared it right up.
Here is some help to the missing en.pws and en.prepl files. I have no idea why the developers failed to provide this simple solution for windows.
Go to the directory of "Aspell", which should have been installed as a sub-directory of NotePad++.
Right click in the main Aspell directory, choose "New" then choose "text document".
Rename the new text document as "en.pws" (without quotes) removing the "txt" extension, press enter key.
Repeat, make another new text document and rename it to "en.prepl".
Open up en.pws in NotePad++
copy and paste the following into en.pws, exactly as below;
personal_ws-1.1 en 2
µÄ
(Note: the µÄ symbols are below, on a new line below personal_ws-1.1 en 2)
Go to the Menu in NotePad++, click "Encoding" and make sure that "Encoding ANSI" is chosen (Dot beside it).
Save file and close file.
Open the en.prepl file in NotePad++
Copy and paste the following into that file;
personal_repl-1.1 en 0
Same, make sure the "Encode ANSI" is chosen.
Save and close file.
Note: you must close each file before using NotePad++ Spell Checker and "learn" button. Else it corrupts the file and you have to redo it.
NotePad++ will now work and you can save words to the ".pws" file.
Possible locations of GNU Aspell custom words file:
%localappdata%\VirtualStore\Program Files\Aspell
%programfiles%\Aspell
For English for example the custom words file is named en.pws (file name = language code) and the very first line must look like:
personal_ws-1.1 en 286
Where "en" is the file name (=language) and 286 are the number of words (lines) in that file. Last line must is always empty. GNU Aspell does not allow words ending with a number (e.g. Beta1). If you have such a word in your pws file Aspell or the application that uses it (e.g. Notepad++) may crash/hang ...
You may have to delete your en.pws file and create a new one (e.g. using Notepad++). File format as described above, otherwise GNU Aspell will fail to work.
I took the read only off of "C:/Program Files/Aspell" folder.
N++ still says
GNU Aspell
Error:
The file "C:/Program Files/Aspell/en.pws can not be opened for writing.
The english .50 dictionary install does not do a proper install into your C:/Program Files/Aspell directories. I had to open the Installer .EXE in WinRAR and copy the folders.
Should I copy the English dictionalry installer into my C:/Program Files/Aspell folder and install from there?
"Ensure that the security settings of the "C:/Program Files (x86)/Aspell" folder for the current user allow for modifying and writing"
"I took the read only off of "C:/Program Files/Aspell" folder. [The error message remains]"
It's not a read-only problem, but permissions. In Security give "Users" "Full control" over the .prepl and .pws files.
The Answer by "sth" and "Mark" is good, but it still has permissions issues in Windows 10. Instead of creating the two files in the Program Files folder for Aspell, create and initialize them on your desktop first; that will give your account full control on the files. (Also, set the encoding before you paste the initializing text.) Then move the two files into the Program Files folder for Aspell, and they will retain the full write permissions of your account without messing with the overall permissions of the Program Files folder for Aspell.