Get the name of last edited user and date of time using vba in shared drive - vba

Please I need help. I have an excel file in a shared drive in my workplace used by many people. I want to display the name of the last user who edited and saved the file in one cell in the file and date and time of edit in another cell in the file. Display to be refreshed whenever document is saved. I will appreciate the full code and directions to paste the code to get it working as I am not good with programming.
Code I researched from the internet and pasted only gets my name and couldnt get others when they work on the file. Will appreciate any help I can get

Related

Google Sheet to PDF MailTo: Part 2

First-timer here trying to modify code to fit my needs without any coding training. I borrowed the following google sheet to pdf mailto script from another poster (Kelvin Chong).
I am able to successfully send an email to myself with an attached PDF, but the PDF is blank. I'm apparently missing something when it comes to the script retrieving the active spreadsheet. The Google Sheet I am trying to send as a PDF is only a single sheet and I have tried both the SpreadsheetApp.openByUrl() and SpreadsheetApp.getActiveSpreadsheet() options. Neither method gives me an error when I run the script and, like I said, it emails me a PDF...it's just blank. Oh, and yes, when running the openByUrl I did enter the URL of the spreadsheet and have checked to make sure it is open for anyone to view.
Any help would be greatly appreciated. Thanks in advance!
Nevermind...I figured it out through some trial and error. Basically, the original programmer wrote the script so that it would send a zip file. Another programmer modified the script so that it would only send an individual sheet. When I started tinkering, I noticed that the zip file would have a blank page and then the actual pdf. Once I realized this, I just tinkered a little with the code to only focus on that second sheet. All is well now!

Attaching a file with a worksheet to be emailed

Just to give you a bit of a background, I am an IT contractor. I was looking for an accountancy package that I could use to do my day to day accounting. After searching for nearly 2 weeks, I was not happy with anything out there. So I've decided to build my own on Excel. I have listed requirements to that end. One of my requirements for the package is to be able to attach files with my workbook so that I can then send them to my accountant. Attachments will be invoices, receipts, expenses etc. My question is, is there a way to attach files with workbook that I can then email with the workbook? I know I can attach files within a workbook but that uses local UNC path and that wont work when I email the workbook. I am not using outlook so that is not something I can tap into. Any suggestions would be greatly appreciated
Click where you want to embed a file and go to the Insert ribbon. Then choose Object, followed by Create from file, and browse to the file. This should 'attach' the file rather than just linking to it.

How do i save Image(Jpg,Jpeg) file in excel for each cell

I want to attach a different image for different cells. SO far I am doing by attach the image via ("link"). I am facing some problem that whenever I try to send file I have to send the corrsponding path file . But sometimes its annoying that folders will be erased or moved . Can anyone give me an valuable suggestions, that I can save all my image in the file(excel) , whereas I can send only the excel sheet, when some one click the cell , corrosponding image boot from the cell(excel).
Is it possiible in excel, if it so please give me the instruction.
thanks in advance
The easiest way to do this is to save your file in older format, for example in Excel 97-2003. By default newer formats keep links, not pictures.
If you insert pictures via a macro, use something like the following:
Cells(1,1).AddPicture(FileName:="C:\1.jpg", SaveWithDocument:=True)
If you are using "insert picture" method via the insert tab in excel, within "insert picture" window you can choose "insert" at the bottom of the window. i'm not too sure how exactly it is called in English, but my translation is pretty close to what it might be.

Trying to extract data from mdb file upon selecting the file in a listbox

I am generating a new project from an existing template every time i click on create and renaming the same as a new project name (an mdb file)in the same directory. The details mentioned in to the right namely location, engineer, contractor etc are stored in this mdb file at this instance.- so far i am successful....
Now that i have the list of projects listed in my list box I would like to select any one and I wish to see the details for the same to my right.
I've posted a link having a .bmp image of the form. Help is highly appreciated.

separate files for VB code and Excel

I'm using Excel 2010. I have some code in background (VBA) that is growing up from time to time. I'm trying to find a way to separate the source code from the xls file, so I could compare the code changes. In other words, I want that the code will be in a textual file, and every time I'll open the Excel file, the source code for macros will be taken from this file.
Thanks in advance!
Take a look at this question on SO.
It has the mention of addin called SourceTools, that I have used & find it worthwhile.
Also, it comes with source code so it can be modified to point it to the source code control software (such as SVN) that is specific to your use.
Feel free to close this question as the link I gave has the same question as yours & answers what I suppose you are looking for.
Have a look at the various code cleaner apps/code available for VBA, such as:
http://www.appspro.com/Utilities/CodeCleaner.htm
Among other things, these export the modules/forms/classes to text files, delete them, then re-insert them into your projects.
With a few mods, that'll form the basis for what you're after.
Another possibility: I don't do much in Excel, but if its add-ins behave like those in PowerPoint, that might help also. In PPT, installed add-ins load automatically when PowerPoint starts, create any user interface needed and are available to use with any open files in the app. To update the code, you modify it, create a new add-in, put it wherever PPT is looking for it, and restart PPT. Voila ... code's updated for all PPT files.
First of all, thank you all for your answers. my solution was:
1. export all the modules to *.bas (one file per module).
2. add the modules code my calling:
Application.VBE.ActiveVBProject.VBComponents.Import (filename)
for each file..
3. after finishing:
Set VBComp = VBProj.VBComponents(moduleName)
If Err.Number = 0 Then 'no error
VBProj.VBComponents.Remove VBComp
that's remove the module so it won't be saved in the xls before quiting
I would recommend a manual process in such a scenario.
Suppose you want to take a backup of Module1, then right click on it and click on "Export File". You will get an "Export File" dialog box. Save it as, say Module1 - 22 Apr - 2012.bas at a relevant location. And you are done
How would this help?
1) The dates in the file name will tell you what date the backup was taken so you can actually keep track of the date when the macro was changed.
2) .Bas files can be opened with Notepad. This will help you in comparing the current VBA code with the relevant backup file.
3) If at any point of time you want to retrieve the backup from a particular date, simply delete the existing module (take a backup of it if you want) and then click on "Import File" and import it in your VBA.
HTH