I run into several issues in my Access application when Excel is in edit mode at the same time.
How can I check if an Excel application is in edit mode from Access (VBA Code)? (So I can stop the Access makro and tell the users to close Excel before they continue)
Thank you very much smart people!
If you mean the excel application is still open in your VBA code, then try these methods.
Firstly, check if all the referenced objects, recordsets, are closed in VBA code. Also the objects and recordsets must be set to nothing.
Or Check your task Manager, there might be an instance of Excel application open.
If not these, what do you really want to do? because when you write a code to fetch data from excel it prompts the user to close the Excel application automatically.
Related
I’m attempting to migrate an existing excel sheet from using links to using data connections to other excel workbooks (Excel 2010). Upon switching my first couple cells, I refreshed the connection to test it out, and while the cells populated just as I’d hoped, excel actually opened the sheet I was connecting to on top of the sheet I was working on. I did see a suggestion somewhere that implied making it a shared workbook would help, but to make the data connections work as desired, I had to create a table on a background tab, so sharing the workbook is not possible.
Is there a way to suppress the sheet I’m connecting to from opening up? I don’t want to go too far down this rabbithole if it’s always going to do this.
Bonus: VBA code for automatically refreshing links every few minutes when the sheet is open, if it’s possible (rather than having the user press a button at will), may prevent me from having to migrate over to using connections to begin with. I’ve just not had much luck finding any that might work so far.
Please let me know if you require further clarification! Thanks!
I am trying to develop a manner in VBA to track changes in a document without having to hide the contents in an extra sheet within a workbook.
I understand that if you change the extension of an Excel file to ".zip", you can access the Excel document as components sorted into directories. Is there a way to save and write to a text file within one of these directories so that I can access it every time the document is opened, without having to have the user drag a log file along with the Excel document?
Some facts:
When Excel opens the file, the file is blocked by Excel. There is no possibility to write to that file within VBA
You can store additional data into that file externally or after the Excel workbook has been closed
You would need to have code externally from the workbook to accomplish writing to that file after it has been closed. You may want to use VSTO or an oldschool Excel Addin.
you have to ensure that Excel will not destroy your changes when restructuring or repairing the file.
In the first run, your idea sounds very natural, to not use sheets from a programmer's point of view. You only have full control on Excel files when
you use external libraries (e.g. Spreadsheet Gear) or
you remote control Excel via automation.
you use openxml SDK for Excel
you use VBA
You could insert additonal information and take care that this information is not skipped by Excel.
When you want to do the tracking this way, I would suggest you to use an Excel Addin. There is actually no need for installation when using this kind of Addin. Attach to open workbook and close workbook events and ensure that all changes are written to the Excel Workbook after it has been closed. Certainly you would have to attach to all kind of other events to track all changes to the workbook. You may need to have in mind that there can be more than one workbook opened at a time.
Actually there are alternatives.
write your logging code in VBA or whatever fits
abstract away how your persist the code (e.g. use a data provider)
think about these two alternatives to store logging data:
You can save logging data in cells of excel. When using a "newer" version of excel, you have a limit of 1 million rows. You may want to implement a rolling mechanism that ensures that you never go over the border of 1 million records. (you may be dont want to track a million changes)
You can use the document properties to store you information as xml.
Last but not least, the most obvious: Why not using Excel's functionality of tracking changes? Understand track changes in Excel 2013
I would like to avoid the conflicing copies Dropbox automatically will create if more than one person at the same time edit an Excel document.
Dropbox have made a smart "badge" with information popping up, if someone is opening the files while you have it open.
If you use VBA to open and save the documents, you might not see this information (especially not if you speed up the macro wiht displayalerts false).
Does someone here know how to make the VBA "ask" for this information? (would need the information to stop the user from saving the document).
There currently isn't an interface for querying this information, but we'll consider this a feature request.
We have an Excel workbook which is similar to an Error Codes database. Unfortunately the application is written in such a way similar to IF (ExceptionCode != AnyPreviousExceptionCode) THEN (Make New Exception Code) which gives the messy problem of new, never before seen exception codes appearing on our monitoring software and requiring a team of analysts to investigate. The point being that this Excel workbook of Error Codes changes alot day to day, especially if a big release comes out.
The problem I have is that there is a team who needs to have this workbook open as they need to consult what error code is what, but there is also one person who needs to update this workbook. Excel of course gives full rights to whoever opens the workbook first and everyone else has to wait, however we have a global team so it's not a simple matter of going over to someone and telling them "please can you share the workbook to me".
Is it possible in Excel to set some users as read-only and other users as write access and have this reflect on the GUI so Excel doesn't make the write access user wait for the read-only user to close the workbook?
In Win7 for Excel 2003, 2007 & 2010 there is a dropdown arrow on the right side of the open button in the open dialog. If you click that you get an option to open the file as Read-Only. Can the non editing users open it like this?
Shift+Right Click on an excel file also gives the option to open as read only.
Sorry man, did not see your question a month ago :)
Need some advice on running an excel add in. I have created an excel add in that, checks workbooks opened by users and determines if the excel opened by user has code behind it. This bit works fine.
However, what i dont know is how to pass the workbook opened by the user to the add in and run the code in the addin.
Please help.
Thanks,
Navin
Googling this problem delivered me this comprehensive link which suggests making use of Application Events:
http://www.cpearson.com/excel/AppEvent.aspx