I'm using a macro to open an other excel file to get data from it. this goes by Workbooks.Open Filename:=totalopen (totalopen =Filepath & filename earlier defined) Because the opening file can have the same filename, my question; is it possible to open the latest/newest saved file? So also look at the saving date/time of opening excel file.
I am using excel 2010 on windows 8. I load a file which has been sent to me via e-mail and save it with an upgraded name, I then do a large amount of data input and save the file again, I do this regularly and even test load it at times to check it has saved, finally I save and close the file and then on reloading I discover the version I have is the first one I saved! all the work I have done on it has disappeared! I also sometimes find random .tmp files with non-sensical names in the folder to which I have saved, but I do not have the rights to open these .tmp files.
When I open any saved Excel file the saved file opens along with a blank workbook titled "Book 1". How can I make it so when I open any saved Excel file it only opens the file I want and not a new workbook every time?
I do routine tasks every day which involves opening 3 different files and pasting data into my main file. The data is always in the same format, and the 3 files are saved in the same location (3 different folders through). The 3 files are saved each day and the naming convention is constant, with only the date changing. For example, the files are always saved in C:My Documents and the files are called test_05.02.2013.xls. Tomorrow the file will be called test_06.02.2013.xls and so on.
So each day I will be rolling a file forward and I want to bring in the info from each of these files based on the new day.
How to do 1, and I will do the others (because the concept will be the same).
I have written a macro but unable to make it work. The macro works but not the way I would like it to.
The macro has to save an excel sheet to a separate folder as a pdf format, a message box should pop up confirming the pdf file and then attach the same saved pdf file to an email.
Now the macro saves the pdf file where I need it to be saved, the msg box pop up and then the pdf file opens up on top of the msg box. If I close the pdf file the msg box which was hidden under the file is now shown. When I click "OK" it goes straight to outlook with the email addresses attached but the saved pdf file is not attached.
I'm on excel 2010 and I have a small group excel files I open everyday. Most of the files are static in name and location. I've got a macro created to open those files, which works fine with workbooks.open and the file path.
There are two report files I want to incorporate into my macro of workbooks to open. The files are created weekly and the files names have the following format: "Report Name (YYYY-MM-DD).xlsm". I don't want to use the file's last modified date because older files may get edited after the more recent ones are created. The files are also not always created on the same day, so the solution needs to be flexible enough to not refer to a specific day of the week or anything.
Macro open an excel file based on the latest date found in filename.
I am wirking on a macro which opens a 'sourcefile' and then do some filtering and vlookuping to distribute the data to several files. When i run the macro from the VBA editor, everything runs fine. But if i run it from .xls file, the macro stops after opening the 'sourcefile'
Workbooks.Open Filename:=sourcefile For i = 0 To 13 'do something... Next
I'm working on a macro for work. It's a simple workbook with about 10 tabs. I would like for the user to open up the workbook but it not have the prompt foir enabling or disabling macros. Just on this one sheet, not other macros on other sheets.
I was wondering if there is a way to open up a given program (notepad in my example) ..paste data from cells copied in excel and save the notepad file to a specific location and close it out?? The file path will be given from a data cell in excel as well as the file name.
From searching the forums i've come up with the way to open notepad using the lines
Dim RetVal As Variant RetVal = Shell("C:WINDOWSSYSTEM32 otepad.exe")
I have a user form with a TextBox (TextBox1), the user enters a filename and presses CommandButton1, this then opens the file. I have set an error trap so that if the file does not exist a MsgBox prompts the user to re-enter. So far so good, however if the error trap operates any further files entered are declared as non-existent even if I know they exist. I thought this would be quite easy but once again VBA bites me back!!
here is my code
stPath = ThisWorkbook.Path stFilename = "Retention" & "" & TextBox1 & ".xls" stFullname = stPath & "" & stFilename 'completes full path of for TextBox1
On Error Goto Errorhandler: 'go to this if file does not exist Workbooks.Open stFullname ActiveWorkbook.RunAutoMacros xlAutoOpen
I use the following macro to save my worksheet. However, if I click cancel when the save box is open, then I am presented with an error. How do I get it to skip the error and show a message box instead that says "File not Saved!".
I have numerous spreadsheets that I need to open and unhide a sheet, that has XML data stored in cell A1. What I need to do is copy that data in cell A1 and paste it into a text document and save that as an XML file saved as the XLS workbook name with a date stamp.
I'm running into many issues, the main issue is the saving as current file name, and the formatting of the text/XML file.
Here is my current code, which doesn't reference the current file name and is just very generic. Once I get the saving as file-name correct and the formatting of the xml file correct, I will work on it a bit more.
Code: Sub Test() Dim Rng As Range Dim wb As Workbook Set Rng = Range("A1:A2") Set wb = Workbooks.Add With wb Rng.Copy
I have a need to open a file from my companies intranet. My current method was to open said file via the method that the recorder gave me. However, I would like ot be able to open a said file without having to start open another workbook.
This is the path: [url]
So the command is this: Workbooks.Open [url]
Links are not actual links
So what I need to know. Is how can I open this file without opening a workbook. I haven't been able to use the VB "Open Statement" to open a file and I don't believe that I've been successfull using the Filesystem object either.
I have an add-in called GeoDesiX. It is a geocoder/mapping tool that uses Google Maps API. It works fine, even on my machine, but I think it was built using 32-bit, while I have 64-bit Excel. When I open the add-in for the first time, an example workbook is below, it works great.
The problem is, that when I save any file with the map in it, the VBA no longer works, and an error pops up in the below code that says: "Object Reference not set to an instance of an object". This happens at the Err.Raise 65000, "GeodesiX", Result part. It looks like it just cannot find the DLL file, which is the "GeodesiX" in that error part. I was reading that it might be caused by switching between 64 bit and 32 bit, but could not figure out how to do it. I am guessing you need to put Private Function Declare PtrSafe, but I could not figure out syntax on how to get that to work. I understand that you will not be able to use these as it is an add-in, but maybe you just know what I need to do in order for the vba to call to the DLL file.
I have a file that keeps setting it's "Saved" property to False when I change something in another file. I cannot find any external links in the file. The file used to be "Personal.xls", but I renamed it.
vba to save data in cells into file name? The vba below works for one cell, but I need info from cell “E11” also with the text MARK between them. myFileName = "2009 CROP BALE CUT OUT FORM – INVOICE " & Format(ActiveSheet.Range("F12").Text) & ".xls" The final file name should look like this: 2009 CROP BALE CUT OUT FORM - INVOICE 8D4512 MARK CB34.xls
I have a template that when it is opened it will automatically save the file to a specific location with the date in the file name.
Currently my code is
Private Sub Workbook_Open() ActiveWorkbook.SaveAs "G:Shared"IT_New " & Format(Date, "mm-dd-yy") & ".xls", , , , , , xlShared End Sub Does anyone know a way to have this code disabled (either by deleting or making it all a comment) on the saved file (xls) so the speadsheet does not try and overwrite itself when I go back and open a previous days spreadsheet?
I'm not sure how I did it, but I opened up a new Excel file and accidentally saved it over a file I've been working on all afternoon. Is there any way to recover the original file (per the last time I saved it about 20 min ago)?
I looked in the "wastebasket" and only found files that I had specifically DELETED. But I didn't specifically delete this one, instead I saved over it.
I'm trying to automate an Excel macro. I need a way to select the latest .txt file from the Import Data dialog box.
I currently have a "CHDIR" at the beginning of the macro that sets the active directory. When I make the "Import Data" pick I am in the proper place. Now if I can only sort the list of .TXT files by date, select the first file in the list and hit ok to continue I'd be off and running.
I have this excel file that is 17 sheets long and I made a table of contents page so it is easier for people to navigate. I know my hypertext links in my file are correct because it works when I click on the hypertexted cells, my excel file jumps to the respective sheet.
However, when I save the file as a pdf the hypertext links do not work. how to get my table of contexts to jump pages in a saved pdf file?
I need the following sort code to run anytime the file is saved....I can't figure out what to title the sub and where to put it (ie. This workbook or in a module). I am attaching the file for reference. The file will not always be saved using the "save as" option - sometimes it is saved just by clicking the "save" icon
I have an Excell 2003 workbook with 6 worksheets and some VBA programmed macros in it.
With a small amount of data the .xls file size is 150k. Then I tested it with a much larger sample of data, which goes into one of the worksheets, resulting size 3MB. Later on I reverted to reading in the original small amount of data but the file size stubbornly sticks to 400k instead of reverting to 150k.
The old data is definitely not there anymore - I used this code to clear it:
I have a template excel file that has links to data in another excel file in the same directory as the template. However, I save the template with a new name in a new folder and the link no longer works. The link changes to the location with the new file and of course the file I am trying to like to is not in that location.
The link shows the full path in the template file so I would think it would keep the full path when saving to a new location but the file doesn't.