UN: Kill And Save As Not Working

Sep 3, 2009

I hate to post this again, but I still cannot figure this out and I haven't gotten any response. I need help folks.

The code below forces a new file to download each time the workbook TEST_CASE_1.xls is opened. I can't seem to get it to kill the _temp.xls file or save the new file (without being prompted "Do you want save"). Any ideas as to what I am doing wrong?

View 7 Replies


ADVERTISEMENT

'Save As' Code Not Working

Oct 29, 2009

Dim myFileName As String
Dim myworksheet As Variant

myworksheet = ThisWorkbook.ActiveSheet

myFileName = ThisWorkbook.ActiveSheet.Range("h1").Value
ChDir "C:TechnologyComponents"

ActiveWorkbook.saveas Filename:=myFileName

There is only one sheet in this workbook, the sheet name changes each time I run other codes. I am bringing the value of the sheet name into a H1 cell and trying to save with that name.

View 14 Replies View Related

Save As Macro Not Working

Feb 17, 2010

I have a macro to export two worksheets and save as, but the save as part will not work, it just exports to Book1.

Ive checked the directory and everything is fine.

I want the value of a cell in one of the exported worksheet to be included in the save as name.

I'm just wondering if the code needs to somehow specify the worksheet to get the cell value from or will it default to the first worksheet. but either way my code is still not working and i can't tell why.

Should i just create a seperate macro for the save as?

Here is the ...

View 9 Replies View Related

Kill Worksheet Code

Nov 12, 2008

Kill Worksheet Code. I am using

View 4 Replies View Related

Kill Filename Command

Jan 17, 2010

I've got a sheet that I need to convert certain rows into CSV for a payroll package. I'm using excel 2003 on XP.

I have worked out a macro to save it as a csv file with a different name. The only way I managed to do this was by creating an xls file with the data I wanted and then saving it as a csv file with a different name. But now I need to delete the intermediate xls file (called pre CSV in this example). I have the following code which seemed to work first time but is now giving me the error "Runtime error 53 - File not found" and highlights the. What am I doing wrong?

Sub Direct() ....

View 9 Replies View Related

Kill Avaya References

Aug 14, 2007

The following code accesses the external aplpication 'Avaya CMS Supervisor' and loops through a worksheet full of data pulling reports. Everthing works great. After running this code there is nothing in Task Manager that is Avaya related, however when I try to physically open/login to the application it hangs at logging in.

In order to get physically logged in, you must shut Excel completely down. That's why I don't think this is Avaya related, but more something in Excel.

Sub AvayaExportServer1()
'These correspond to menu:Tools References associated with Avaya
Dim cvsApp As New cvsApplication
Dim cvsConn As New cvsConnection
Dim cvsSrv As New cvsServer
Dim cvsCatalog As New cvsCatalog
Dim cvsRpt As New cvsReport
'Used in the For/Loop to increase rows by 1 from list of Avaya inputs on worksheet
Dim x As Integer
Worksheets("Server1").Activate

View 8 Replies View Related

Cascaded Open / Close / Save Not Working

Aug 3, 2009

I have a 'Summary' workbook which collates values from a series of 'sub-workbooks', (and can also update values in those sub workbooks).
the subworkbooks are setup so that when they are saved they also copy certain values out to another 'backup' file.
So there are 2 possible routes that the files will be used in:

1) SubWorkbook opened directly
- User opens SubWorkbook and makes some changes.
- User closes the SubWorkbook saving changes, or clicks the save button. The BeforeSave event opens the "restore" workbook, copies over the key values from the subworkbook, then saves & closes the "restore" workbook.

2) SubWorkbook opened remotely
- User / Admin opens the "Summary" workbook and changes an option.
- The summary workbook opens a subworkbook and makes changes, then saves it. The subworkbook should (as before), then open the restore workbook and save the key values etc.

The problem is in the second scenario the 'restore' workbook doesn't get opened.

I have created a set of 3 workbooks to illustrate the problem here.
Book1.xls = Summary workbook
Book2.xls = Subworkbook
Book3.xls = Restore workbook.

If you open book2 and then save it the 'BeforeSave' event will cause it to open book3 and write the output of 'Now()' to the next free row of book3-columnA, before then closing and saving book3,......

View 3 Replies View Related

Macro Not Working Except In One Tab, Must Save And Reopen To Work In Others.

Oct 17, 2009

I have a wierd issue. I have this macro for a workbook i use and if i run the macro in the first tab it runs and works fine. When i select the other tab and run it it gives me a debug error. If i close the worksheet save it and reopen it and run it in the other tab it runs fine.

So in otherwords i have to run the macro in the tab desired, save it , and always close and reopen the file to run it in the other tabs. I know the code is correct because it runs flawlessly without errors but i must be missing something.

Also i currently have the macro to run on the active tab/worksheet. Can i have it run on multiple tabs? i have 15 20 and 30 tabs in this example file but in my real file i have many more milage intervals ( some tabs i would not want to select ). It gets tedious having to select one tab at a time, run the macro, rinse and repeat.

For Example Run Macro First, in the first tab. It works perfectly. Go to the second tab and run the first macro. It gives a debug error. If you save the file and reopen it and go to teh second tab and run the macro again it works.

View 8 Replies View Related

VBA - Code To Save File In New Directory Not Working

Oct 29, 2012

I have some code that copies a worksheet and saves into a new workbook and saves into a specified folder and renames the new workbook.

It is all working fine however it is saving to my desktop and not the specified directory. I know there is a lot similar out there and i have exhausted my google skills trying to find the similar format to the one i am after.

Code:

Sub MonthlyReset()
Dim sourceSheet As String
Dim clearR As Range
Dim newFile As String

[Code]....

View 2 Replies View Related

Variable Picture That Does NOT Kill VBA Times

Sep 11, 2012

I have a template that needs to show one of 4 logos. The logo shown is the ONLY difference between the four models (A, B, C & D). My life would be much simpler if the template includes all four logos, and a switch controlled the one logo they want to see on each model. But the way I first programmed it absolutely KILLED my processing times for the model's many VBA macros.

What's the best way to accomplish this objective without sacrificing my VBA?

View 2 Replies View Related

Kill And Insert Event In Workbook_open

Sep 22, 2006

Private Sub Workbook_Open()
If ActiveWorkbook. Name = "UserA.xls" Then
Call PreviewList
Else
Cancel = True
End If
End Sub

After the macro auto-startup, UserA works on the worksheet and input some procedures and save as ClientA.xls. However, before save as ClientA.xls and close, UserA wants to change the worksheet name and Procedure name as below, how to do that?

Private Sub Workbook_Open()
If ActiveWorkbook.Name = "ClientA.xls" Then
Call RevisedList
Else
Cancel = True
End If
End Sub

View 2 Replies View Related

Kill Files With Specific Names

Mar 9, 2007

I have a directory that contain a large number of files. How do i preserve certain files with specific filenames while other files are deleted?

For example,
I have files that are named : "58-26150B", "58-26200", "58-26200B", "58-26500B", "58-26550" etc. Please refer to uploaded screenshot.

The files that i want to keep from the above are "58-26200", "58-26200B". The code should be able to loop through the entire directory & preserve only specific files while deleting the rest.

Private Sub CommandButton18_Click()

Dim nWave As Integer, i As Integer
Dim ConvergedFile As String, Pattern As String, KillFilePath As String, SimilarFile As String

nWave = Worksheets("nomogram").Cells(13, 4)
For i = 1 To nWave
ConvergedFile = CStr(Worksheets("nomogram").Cells(33, 3 + i)) 'Loop through list of wanted file names "58-26150", "60-25950" etc
Pattern = Mid(Trim(ConvergedFile), 1, 3) 'Update the filename prefixes i.e. "58-", "60-" etc

View 6 Replies View Related

Excel 2010 :: VBA Save AS (word Document) Not Working

Nov 8, 2012

I have a long bit of code that at one point saves a Word document and then saves it again with a new name and the old (legacy) .doc extension.

This all works find when the user is running Office 2007. However, it errors out for using Office 2010. The reference libraries are all correct (as far as I know).

Code:

Dim myDoc As Word.Document
Dim saveAsName as String

saveAsName = "some text here" + ".doc"

myDoc.Save

myDoc.SaveAs fileName:=(saveAsName), FileFormat:=wdFormatDocument

View 9 Replies View Related

Workbook Save Not Working With Basic Code Included?

Feb 26, 2014

I am attempting to save a workbook when it opens, but when the code is run, it is not saving. For the purposes of finding the problem with the code, I have simplified it down to the following:

Code:
Private Sub Workbook_Open()
Range("C3") = "HEY"[code]......

View 8 Replies View Related

Auto Save Sheet To PDF Macro Not Working When Transferred From Win XP To 7

Jun 3, 2014

I'm fairly new to macros but somehow i managed to create all the required macros for my project through googling and the like. The problem is that i created my macro enabled excel file in XP and when i transferred it to Windows 7 the auto save to PDF macro stopped working with the Runtime Error '5' Invalid Procedure, call or Argument. The highlighted error is as follows.

ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
FileName:="C:WindowsTemp emporaryexam.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True

This auto save is supposed to work when a hyperlink is clicked or when the set time runs out (Working Macro).

View 5 Replies View Related

Kill Command - Using Directory From Workbook Cell

Feb 15, 2010

I want to use the following kill command to delete all files in a folder:

Kill "C:dsmanagerest*.*"

However, I want the directory to be specified not within the code, but within a cell on a worksheet. Ie. Cell A1 would contain the directory C:dsmanager est*.*"

View 6 Replies View Related

Code Stopped Working - Can No Longer Copy And Save Worksheet

Jul 31, 2012

I have been working on this application for the past couple weeks and I have this module of code that copy's a worksheet into a new workbook and changes everything into values. However I have added buttons onto this sheet and after running the code again it froze the program, in which I had to manually end. It gave an error afterwards however I don't remember what it said. Now everything I try to run or step through it, nothing happens. And I have turned Events and ScreenUpdating on.

I would also like to note that it won't allow me to perform actions like unhide sheets or unprotect them. The code has not been changed either so what has happened to disable all functionality.

[URL] .....

View 1 Replies View Related

VBA / Code Stopped Working - Can No Longer Copy And Save A Worksheet

Jul 30, 2012

I have been working on this application for the past couple weeks and I have this module of code that copy's a worksheet into a new workbook and changes everything into values. However I have added buttons onto this sheet and after running the code again it froze the program, in which I had to manually end. It gave an error afterwards however I don't remember what it said. Now everything I try to run or step through it, nothing happens. I have turned Events and ScreenUpdating on.

View 2 Replies View Related

Macros That Were Working In Excel 2003 Are Not Working In 2007

Jan 25, 2010

I have a workbook in excel 2003 which I had been running the following macros (listed below). We recently upgraded to Excel 07, and neither are working. When I try to run them, the "debug" option highlights the following line in the sort macro "Range("A2:z" & lastcell).Sort key1:=.Columns(1)". This is driving me crazy, as the macros worked perfectly under the older version of Microsoft. Is there an issue with crossfunctionality between '03 and '07'.

Private Sub Worksheet_change(ByVal target As Excel.Range)
If target.Column = 1 Then
ThisRow = target.Row
startRow = 1
i = 1
Set ws = ActiveSheet
maxRow = Cells.SpecialCells(xlLastCell).Row
maxCol = Cells.SpecialCells(xlLastCell).Column
ActiveSheet.UsedRange.Interior.ColorIndex = xlNone
Do While i

View 9 Replies View Related

Excel 2010 :: Save Open Worksheet To File And Include Date Of Save?

Mar 11, 2014

am using Excel 2010 and having issues trying to save a worksheet to a specified file location with the save date....

I have tried several posts form this forum and elsewhere and can't seem to get the macro to do what I want.....

I want to save a 'worksheet' from an open workbook that I use for updating information to the same file path as the workbook with the date the file saved...

View 6 Replies View Related

Excel 2003 :: Unable To Allow Users To Make Changes To Workbook But Only Be Able To Do Save As Not Save

Dec 3, 2012

I have an expense report, which was originally done in Excel 2003. It still prompts users to open as read only however if they select no, they are not prompted for the password, and it has allowed them to save, so when the next person opens it, they have the previous person's report instead of the clean workbook. I have tried everything to put a password onto it. I know this is really basic stuff, but maybe I am missing a step? I want the end user to be able to make all the changes they want in read only mode and then do a save as, but if the select No when prompted "Open as Read-only?" they should have to put a password in.

View 4 Replies View Related

Excel Save As Should Default File Save Type To XLSX Using VBA

Aug 21, 2012

What I am trying to do is that I have an excel file with macros and it is a read-only file. In order for the user to save, I want them to only be able to save as a .xlsx file as it disables all macros. If for whatever reason, the user wants to save the file as another .xlsm file, they should be allowed but before they save, a "are you sure you want to save as .xlsm?" message should pop up.

All the options in the save as box should still be available in case they want to save in that particular format. Just that the .xlsx should be the default.

View 2 Replies View Related

Macro To Check If Saved Then Save Else Bring Up Save As Dialog

Sep 6, 2012

I'm trying to make a macro check if a file has been saved (ever). If so I want the macro to do a regular save (with already esatablished filename and location) before it proceeds with the rest of the macro. If the file hasnt been saved (if it runs from a new workbook) then I want it to pop up the save.as dialog, so that the user can choose the name and location of the file before the macro continues .

The macro itself is saved in personal.xlsx.

View 1 Replies View Related

Customize Look In/Save In (My Places) In Open/Save As Dialog Boxes

May 10, 2008

I would like to add some icons on the left side of excel open file pane to faciliate my work. Because i need to load some files under the same folder many times a day. Does anybody know how to do that? I've seen people has more icons on the pane before. The defaut setting has only 'History', 'My Documents', 'Favorites', 'Desktop' and ' My nutwork places' on it.

View 2 Replies View Related

VBA - Use Command Button To Obtain Save As Screen And Save As PDF

Jun 22, 2014

I have a UserForm in which i have inserted a CommandButton. I also have a Table on a Sheet in Excel that i would like to save as PDF.

When i click the CommandButton on the UserForm i would like the SaveAs screen to come up and have the Table (or Used Range in the Excel Sheet) as the selection to be Saved as .PDF format.

View 3 Replies View Related

Code, That Disables Save, Save As And Close Commands

Nov 2, 2009

Each of the worksheets in my model use A1 as a control cell for any errors and inconsistencies. My aim is to disable save and close commands in case A1 is not equal to 0 in any of the worksheets.

The code I currently use for that purpose is as follows.

View 2 Replies View Related

Save Workbook Using Variable For Save As And For A New Folder Name

Jul 31, 2009

I have figured out how to save the workbook using a variable to saveas but I would like to create a new folder to place the new workbook into. I have tried a few things a am not having any luck. I recorded a macro and the code it produced is as follows.

View 6 Replies View Related

Save As Macro :: Save File To Folder

Jan 17, 2010

I have a macro that copy one sheet of the Active workbook and sends it via email.

I need to add a code in this sheet so when one opens it from the email, with a command button to be able to save the file to specific, fixed folder on the local network with it’s original file name.

View 10 Replies View Related

Save Back Up Copy Online At Each Save

Mar 27, 2008

I have a sheet which I would like to back up online every time it is saved.

I have a sub, OnlineFile(), which I have used many times without any problems, which creates a .BAT file to use ftp to upload files onto our server. As arguments, it takes the local file path that you want to upload (or download to), the name of the file as you would like it stored, the online file path, and whether you want to upload the file onto the server, or download it off the server.

It should be very easy to combine the two: what I tried was:


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, cancel As Boolean)
ThisWorkbook.SaveCopyAs ThisWorkbook.Path & "" & "Rubbish.xls"
Call OnlineFile(ThisWorkbook.Path & "" & "Rubbish.xls", "Rubbish.xls", "wwwrootexcelfilesMasters", "Upload")
Kill ThisWorkbook.Path & "" & "Rubbish.xls"
End Sub

Every time I ran this, the file got uploaded correctly, but Excel had a series of problems. Often the code ran fine the first time it was run, but crashed the second time round.

After a fair bit of troubleshooting, I found that the problem came about when the file was trying to save itself - i.e. after the end of the sub. If you pause any macros from running, it still saved fine, but when the code ran, it found errors, froze or closed excel.

My thought at this point was that the code was fragmented or something. I made a new sheet, and retyped just the relevant bits of code (i.e. the BeforeSave sub, the OnlineFile sub and created the form called by OnlineFile). The problem persisted.

I've come up with a workaround for this now (which uses the same OnlineFile sub & form, and works fine), but it's driving me crazy - why does this cause excel to die? Particularly on the second time through? The code seems far too simple to cause such problems - is there a bug in Excel perhaps (I'm using Excel 2000 on Windows XP).

View 9 Replies View Related

Disable Save And Save As Feature In VBA

Sep 5, 2012

I am trying to disable the save and save as function using a macro, i know that this in its self is quite simple but i am making VBA create a new workbook and i want this (nameless) workbook to have the save feature disabled.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved