Opening a file with code breaks formulas? - excel

I need to open another workbook, so I execute this code:
Set wbOpen = Workbooks.Open(PathFile)
If I open the file with this code some formulas have #names errors.
If I open the file manually (without vba) I have no errors at all.
If I open the file with this code, get the errors, save the file and open it manually, errors remain. If I validate all formulas one by one from the beginning the formulas work again.
There are no external links to any other workbooks in this file.
I don't understand at all why opening a file with VBA code is different than open it manually?
How can I find the source of this bug?

Related

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.

How do I open my Excel sheets without VBA error message?

Excel automatically updated last week. Every spreadsheet I open now comes up with error code Run-time error'53':
File not found:
/Library/Application/Application Support/Adobe/MACPDFM/MacPDF.framework/Versions/A/MacPDFM
Help and End buttons show. Help does not describe my problem.
Clicking End twice gets rids of the error message and the spreadsheet opens. I have no idea how to solve this. I am not a programmer and I have not changed any settings in Excel.
Apparently your Excelfile contains a macro, who tries to open the following file when you open an Excel worksheet:
/Library/Application/Application Support/Adobe/MACPDFM/MacPDF.framework/Versions/A/MacPDFM
When this file is not present, you get the mentioned error message.
Seen the structure of the directory, I believe the Excelfile only can be opened on a Mac-computer (Microsoft-computers don't have the mentioned directory structure).
Verify if you're working on a Mac-computer or a Windows-computer and in case of Mac, check the presence (and read permissions) of the mentioned file.

Macro Cannot See Open Workbook from Sharepoint

I am running a macro from an excel workbook on my local machine, and at the end of it the macro copies a set of data and pastes it in a log that is in a separate workbook. I can get it working fine when the log is on my local machine, but I am having trouble getting it to copy data to the log when the workbook is stored on the company sharepoint server. I have both files open in excel (with edit permissions on the sharepoint based file), but when I try to open the workbook it fails. Trying to diagnose the problem I even had the macro spit out a list of all the open excel files at the moment and it does not seem to list the sharepoint baesd file (despite it obviously being open at the moment). Any ideas on how I can access this file? I don't necessarily need it to open the file on its own, I am more than happy to go into sharepoint manually and open the file, I just can't get the data to copy across for some reason. Any help that could be provided would be most appreciated, thanks in advance!
The line of code causing the problem is:
Set logbook = Application.Workbooks("Log")
Where the file name is Log.xlsx and that file is open in excel at the time the macro is running.
The error I get is:
Run-time error '9': Subscript out of range

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.

How to run a vba macro for multiple excel files

I am a naive user of VBA and I am looking for a VBA macro which would do the following task
Delete 3 tabs from the file and delete the first 6 rows from remanining tabs.
Perform this for all the excel files (2013) and save as xlsx in the same or different file folder.
I tried the code available on this link
Run same excel macro on multiple excel files
At the line
Filename=Dir(Pathname & "*.xlsx") , I am getting an error which says run time error "52" Bad file name or number.
I have changed this:
Pathname = "\C:\Users\Desktop\test\try\"\
Is this correct?
Not sure if it's your only problem, but
\C:\Users\Desktop\test\try\
should be
C:\Users\Desktop\test\try\ (without the first backslash)
*I realize this should be a comment--I'm under 50 rep, however.

Resources