Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 13-05-2009
Member
 
Join Date: May 2008
Posts: 979
Creating a macro for a backup button

I am a beginner in macro. In my excel file, I want to put a button which can take a back up in the same Excel file but in another format.

The file will be saved in .csv format.
Reply With Quote
  #2  
Old 13-05-2009
Member
 
Join Date: May 2008
Posts: 685
Re: Creating a macro for a backup button

The below is an example in which I have the filename (without .xls).

The active file is saved in .csv file without closing it.

Code:
 Sub backup_file_csv () 
   rep_backup = "E:\file_csv" 
        filename = activeworbook.name 
  if instr (filename,".xls")> 0 then  
  filename_csv = mid (filename, instr (filename,".xls") -1, len (filename) - 3) & "csv" 
      Application. DisplayAlerts = False 
      ActiveWorkbook. SaveAs Filename: = rep_backup & filename_csv, _ 
          FileFormat: = xlCSV, CreateBackup: = False 
    Application. DisplayAlerts = True 
  else         
   msgbox "The file is not an active file with extension .xls, no treatment done" 
  End if  
  End Sub
Reply With Quote
  #3  
Old 13-05-2009
Member
 
Join Date: May 2008
Posts: 979
Re: Creating a macro for a backup button

Thank you for your help. I don't know if it was not possible to go through simple manipulation of an object? Or is it mandatory to go through the code?
Reply With Quote
  #4  
Old 13-05-2009
Member
 
Join Date: May 2008
Posts: 685
Re: Creating a macro for a backup button

I do not understand the meaning of what you are trying to say.

Otherwise, there is the possibility: in the File menu -> Save As - CSV file type

This is because at each record, there is a warning message which prevents the loss of information due to the change in format.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Creating a macro for a backup button"
Thread Thread Starter Forum Replies Last Post
How to rename from button with macro in Microsoft Excel Kanshin MS Office Support 16 24-02-2012 01:59 PM
Help for Creating a Backup MX Server UseME Networking & Security 5 24-03-2010 05:48 PM
Insert media notification error while creating backup image of windows 7 Hecter Operating Systems 3 09-12-2009 07:39 PM
Creating macro to insert Excel sheets KABIRA16 Software Development 3 07-12-2009 09:29 PM
SBS 2003 SP2 backup failed with error creating volume shadow copy Rayson Windows Server Help 5 06-11-2008 01:21 PM


All times are GMT +5.5. The time now is 09:04 PM.