Macro Cannot See Open Workbook from Sharepoint - excel

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

Related

Export Excel (for Mac) Sheet to CSV works only on my system

This is my first time on StackOverflow and first post so please bare with me. I have created an Excel (for Mac) Macro-enabled workbook which takes data into one sheet, manipulates it slightly and updated a 2nd sheet. One the first sheet is a button with some basic code behind it to export the 2nd sheet to a CSV file. The workbook and macro within work perfectly for me on my Mac however I need to share with my peers at work so they can do the same but it will not work on their Macs. I don't know why it doesn't work on their systems.
When I sent the Excel file to my peer to generate the same CSV file for his team's data it didn't work. He is receiving a "Run-time error 1004: Cannot access read-only document".
Macro Line where error occurs
Error Dialog Box

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.

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.

Excel Vba not opening correct workbooks?

My excel code was able to iterate through every workbook in a specified folder, although it does so in an eternal loop. (Which i stop using the keyboard interrupt)
Vba based off this: http://www.ozgrid.com/VBA/2007-filesearch-alternative.htm
Now, after switching PCs, the code has gone haywire. The vba is still the same but instead of opening workbooks in the specified folder, its opening workbooks in the folder one folder before it.
E.g Vba is in S:\Excel\Test
It will open books in S:\Excel
Instead of a specified location in C. Drive S is a networked drive
Not only that, while it used to iterate through EVERY file, it now just keeps resetting and opening the first file again and again
Using Excel 2007
Guys the answer is simple. Because im using a networked drive, one should refer to the drive on which the workbook is stored. Adding one line to the top above ChDir solves this
ChDrive (Left (ThisWorkbook.Path, 2))
Im also glad to report that this question did not require me posting my code as well.

Resources