I have a heavily formulated workbook which will be used by staff members who will paste in potentially confidential client information. The workbook then comes up with graphics and data to summarize the imputed information
In an ideal world, the people using the program will be able to Save specific sheets as a PDF and would be able to close the program without saving changes to the worksheet but Excel always demands to save the template first, THEN will allow PDFs. This is obviously a problem as if a person uses it, paste's in a client's information and saves the result as a PDF then whoever next opens the Excel workbook will have that previous client's information showing.
SO. I either need a way to tell Excel to not require compulsory saving to allow PDF conversion or another option which will result in the same thing.
I should also note that the workbook has to allow users to paste in information so I don't imagine a Read Only will help :/
I have also attempted using a Macro-Enabled Template which still has the same problem
I imagine there's a ridiculously simple solution to this.
Thanks in advance
Related
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.
I have to code an automated mail. This is a weekly report, containing texts, outlook tables, and up-to-dates excel charts. edit: before sending it, I need to check the mail.
I don't know what is the better way to code that and I want your point of view.
My first option is to create a special workbook with a new macro, and do everything with this new macro. I don't see any problem in managing multiple others workbooks and charts. But I am not sure if I can easyly works with the mail. Would it be possible to write/create table in outlook from excel ?
My second option is to work with outlook. I think I can write some code somewhere to launch excel macros and updates my tables. But i don't know much about this.
What would be the better approach ?
Edit: Let's say that I am just a little intern (lucky enough to make others thing than coffee), and the report is for my manager's manager's manager. No flexibility.
I would just email them the workbook with the report information in it. If they are employees of your company and they recognize your email(or the company's email) there shouldn't be a security issue with just sending them the workbook as an attachment with all th reports in it. You should be able to do that from Excel: http://msdn.microsoft.com/en-us/library/office/ff458119(v=office.11).aspx
You can update the excel file and then concatenate your data together to form the email body as well if you want - as well as obviously email the workbook itself or another updated workbook if you want.
Would be a big project if you are a beginner with VBA but is certainly doable.
If you're working with Outlook, you may also have access to 'SkyDrive' which will allow you to upload documents and files to shareable folder(s) and then send out alert emails to those sharing the folder. Probably a lot easier than writing some code that will most certainly have a never-ending maintenance burden.
Currently we have a Excel VBA application, which consists of 25-30 Excel sheet (and all of those sheets all hidden and we do background processing on them and display it to VBA forms UI), and we have developed a UI using VB forms. But problem we are facing is whenever we click on Save button using this code:
ThisWorkbook.Save
But this saves entire workbook not an individual sheet, so even if we make changes in single sheet it saves entire workbook and this save processing makes very slow (since it needs to save all excel sheet containing lot of data unnecessary, even if there is no changes).
My question is is there any way we can save "only one sheet in a particular excel sheet" not an entire excel file?
Note: I am a Java developer and I worked on VBA before, But it was years back, and I have forgotten bit. Any guidance would be appreciated. Or any pointers on how to handle this situation would be appreciated. Please let me know if you need any more information, I can edit this question.
What I have tried already? I did a lot of research from yesterday, I searched in previous questions on SO, but didn't get any useful information. As per my research it says we cannot do this. Am I on right path?
The short answer is no. You cannot save a single worksheet at a time.
You may want to try to reduce the amount of data in the workbook. Try storing data in several workbooks and when it is needed, open that specific workbook, make the needed changes, and then close it.
If it is necessary to have access to all data at once then consider using access or some other database.
It is also possible that the sheets have "blank data". Cells that don't contain anything in them but excel thinks they do so when saving it tries to save way more than needed.
Assuming that it is the active worksheet that you want to save then you could do something like this:
ActiveSheet.Copy
ActiveWorkbook.Close True, "path"
This copies the active worksheet which creates a new workbook which will become the active workbook. Then just call the close method on that and give it a file name.
I think you should consider splitting your application into multiple workbooks:
The workbook that contains all the logic, user forms and programming code. This workbook handles all other workbooks as well as the displaying of it. Potentially, this could be even an "Application Specific Addin", that stays dormant but activates as soon as any of it's subsequent workbooks gets opened. For this architecture approach check out the section on "Application Specific Addins" in this link.
This workobook/add-in can also hide the other workbooks, so that the user will not notice it's multiple workbooks.
One or multiple data workbooks: Depending how interlinked the data is, you can separate this, e.g. in a "Sales data" workbook which contains the large database, as "Base data" workbook, that contains all the smaller data (e.g. products or stores tables).
This way, you can reduce the saving to the "relevant" sheets. However, of course this requires quite a bit of reprogramming - but it's worth the effort, as for instance it also allows to provide updates/bug fixes without having the transfer the data between versions, as you only need to distribute the the file with programming logic. :-)
I am new to writing excel add-in (in C#) and trying to figure out the right way to save some internal data structures so I can restore the state the next time file is opened. I can convert data in xml or base64 strings if it makes things easier. I don't want to maintain a separate file and would like to embed this information inside excel worksheet.
Many thanks for your help.
Use a cell in an invisible sheet (you can name it, for example, "internal data sheet") for storing the information. Excel sheets have a Visible property which can be set programmatically to `xlVeryHidden' which means it can only be made visible again by a program. Here you find some more information:
http://support.microsoft.com/kb/142530/en-us