Error importing pictures into an Excel file using ClosedXML - excel

I have a problem with importing pictures in Excel. I usually use ClosedXML, but it cannot import pictures and first have to be saved in ClosedXML, and open in OpenXML, to insert a picture. As a result, when you open a file, I get an error.
"We found a problem with some content in 'error.xlsx'. Do you want us
to try recover much as we can? If you trust the source of this
workbook, click Yes."
If I save a picture in the Excel file already manually create everything works fine. The problem occurs when you save after ClosedXML.

Related

Automatically import data to hidden excel worksheet

Small preamble:
I started working with a new company. The guy before me made this excel file but made it impossible to modify, and now that we're changing the protocol, the company is a bit in a pinch.
What the original file does:
When opening the file, a data import wizard pops up immediately, asking for a source. Once the source is selected, it uploads the data in a hidden worksheet, and the main worksheet makes its calculation. The User experience is: one opens the file, selects the correct .csv, and he's done.
I managed to redo almost everything; I reproduced the calculations, made an hidden sheet, and formatted the wizard so that the data imported are correct, but no matter how hard I tried or look on the internet, I could not make the wizard window pop up when opening the file.
Does anybody know how to make the data import window pop-ups immediately when opening the excel file?
Thanks in advance.

Opened up a .iqy file yesterday in Excel, now every time I try to open a new workbook, Excel tries to open up this file

I downloaded a sharepoint list as an .iqy file and used it in a Excel workbook. But, now when ever I open any Excel workbook it tries to open that file. To try and fix the issues I've:
-Deleted the .iqy file, now Excel just gives me the prompt it can't find the file.
-Removed the connection from the original workbook, but every new workbook still gives me an error looking for it.
-In the Trust Center, set Excel to not open untrusted .iqy files, still not working.
The connection to the iqy file does not appear in any new or old workbooks, and isn't in my recent connections. Also weirdly, it's trying three times to open the file (I have to click "OK" on three separate dialog boxes about the file missing).
Any ideas how to stop excel from trying to open this file every time?
Managed to fix it after stumbling through all the option in Excel. It had nothing to do with the connection. Somehow, the file was added to the "Add-In" list, so I had to remove it as an Add-In. I'll leave this question up for posterity.

View removed VBA code after repair of Excel file

I am getting an error when opening excel: We found a problem with some content in XXX. Do you want us to try and recover as much as we can? if you trust he source of this workbook, click Yes."
clicking Yes, "fixes" the issue but deletes a lot of VBA code, two weeks worth.
Whatever the issue it was introduced yesterday, I do not want to redo two weeks worth of coding. Is there anyway I can view what was removed, or open the VBA in notepad++ or something without opening the excel?
I opened another excel workbook and tried all the different options for the argument XlCorruptLoad in the Workbooks.Open to open the corrupt workbook. I noticed that there were two non existing sheets created in the project explroer of the corrupt workbook that had the code in there. I am not sure if it did that s a result of what I did or it was there all along and I did not notice it
Note that the reason I had a corrupted data is because the code was extracting a list and putting it in a cell validation formula..i guess I overloaded it.

Error with 'Open' Method, "We found a problem with some content in "xxx.xlsx". Do you want us to try to recover as much as we can?

I use Open file method in VBA to Open xlsx. file
But I have issue that the xslx. file has error.
When I opened xlsx. file, the content of message box is: " We found a Problem with some content in ".xlsx file". Do you want to recover as much as we can? If you trust the source of this workbook, click yes".
If i click yes, this message box appears: "Removed Records: Merge cells from /xl/worksheets/sheet1.xml part"
So, because of error in xlsx. file, I can not Open the file in my vba code by using "Workbook.Open(application.GetOpenFilename)
Thanks for helps.
I think your input file is kind of broken.
Try to open the file manually, and copy/paste the data in a new workbook, then save it again with a .xlsx format.
If you cannot open it manually, VBA will most likely not do it any better.

VBA Module disappears after saving Excel workbook

I was just introduced to VBA. However, on saving my first excel file with VBA code, with .xlsm extension (I was advised to do so), and then reopening that saved file, I realized that all the VBA code had disappeared and the cells in which I had used the user-defined functions threw errors. Saving the workbook as .xlsx instead of .xlsm also didn't help. When I tried saving the VBA module, it showed that FUNCRES.XLAM is read-only and hence cannot be modified, and so try saving it at a different location. Doing so, saved an excel file which on opening showed a pop-up message that it's corrupt so can't be opened. Then I gave all permissions to FUNCRES.XLAM and it is NOT read-only. But the problem still prevailed. What should I do? Can someone please help me?
PS: It is Windows 10, Office 2016.
Your VBA code needs to be saved in a module within the same workbook in which you are working. This will probably be listed as VBAProject(Book1)
There will likely be other projects listed in the Project Explorer window of the VBA GUI, but your code will not get saved with those modules.
These are related to add-ins, and not to your workbook.

Resources