Prev: Customized toolbar button trigger macro in a different file
Next: Simple... Using FIND, I need to get the row and cell
From: Jerry Eco on 21 Apr 2010 18:19 ActiveWorkbook.Save creates a new spreadsheet in Documents instead of saving the spreadsheet in its current location. I am using Excel 2007 with a 2003 file (.xls). The macro is in personal.xlsb and is used to make a few minor fixes to the active spreadsheet. I want to save the active spreadsheet before I make those fixes, in case something goes wrong. But, it needs to save it in place, not create a new file somewhere else. Thank you. Jerry
From: broro183 on 21 Apr 2010 19:41
hi Jerry, Has the file previously been saved? Do you have the right permissions to save it in the particular directory? If the file hasn't been previously saved, make sure that you explicitly define the entire filepath to ensure that it saves in the right place. Try checking [alt + t + o] - Save - Default File Location & emptying this field if it's populated. Is your current directory actually what you think it is? You can check this in the VBE - [ctrl + g] to bring up the Immediate pane and type in VBA Code: -------------------- ?curdrive -------------------- If it isn't the drive you expect to see, you can modify it within your macro using the below (Google for examples). VBA Code: -------------------- chdrive 'and chdir -------------------- hth Rob -- broro183 Rob Brockett. Always learning & the best way to learn is to experience... ------------------------------------------------------------------------ broro183's Profile: http://www.thecodecage.com/forumz/member.php?u=333 View this thread: http://www.thecodecage.com/forumz/showthread.php?t=197500 http://www.thecodecage.com/forumz |