Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 7 of 7

Thread: Save Cell Content As Separate File

  1. #1
    Join Date
    17th August 2006
    Posts
    27

    Save Cell Content As Separate File

    Hi All,

    I had created a macro that submits an XML data to a model and retreives the info. This part is working absolutely fine.
    Now my problem starts.
    The request and the response of the model is be displayed as an XML and is in a single cell. I want to save the content of the cell as a seperate file. with naming convention "XYZ.xml" name.
    I would require your esteemed help
    I tried looking into http://www.ozgrid.com/VBA/save-as-cell.htm but it was of not that much help.
    Kinldy help me out

    Thanks
    Sridhar
    Last edited by Chakri007; December 15th, 2006 at 02:06.

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,716

    Re: Save Cell Content As Seperate File

    This will do it

    VB:
    Sub SaveCell() 
        Dim wSheet As Worksheet 
         
        Set wSheet = Sheets.Add() 
         'Cell with data
        Sheets(1).Range("A1").Copy wSheet.Range("A1") 
        wSheet.Copy 
        ActiveWorkbook.SaveAs Filename:="File path and name" 
    End Sub 
    
    

  3. #3
    Join Date
    17th August 2006
    Posts
    27

    Re: Save Cell Content As Seperate File

    Hi Dave,

    The Trick Works for creating a new Excel file but whenIi try to implement the same to be saved as an .XML format it doesnot work.
    VB:
    Sub SaveCell() 
        Dim wSheet As Worksheet 
         
        Set wSheet = Sheets.Add() 
         'Cell with data
        Sheets("AnalysisCases").Range("D2").Copy wSheet.Range("D2") 
         
        wSheet.Copy 
        ActiveWorkbook.SaveAs Filename:="File path and name.xml" 
         
    End Sub 
    
    
    Kindly help me out

    Thanks
    Sridhar
    Last edited by Chakri007; December 16th, 2006 at 00:37.

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,716

    Re: Save Cell Content As Seperate File

    The Macro Recorder is your friend

    VB:
    ActiveWorkbook.SaveAs Filename:="File path and name", FileFormat:=xlXMLSpreadsheet 
    
    

  5. #5
    Join Date
    17th August 2006
    Posts
    27

    Re: Save Cell Content As Separate File

    Sorry Dave for the Trouble
    but the above said doesn;t work fine.. Whenever I try to save the Sheet I find that the whole sheet is being saved rather than the cell specified.

    I want the content of the cell to be copied to a notepad and saved as XML.
    I tried recording the macro but that did not help me much

    I have placed a sample for your reference
    kindly help me out.

    thanks
    Sridhar
    Attached Files. REMINDER! OzGrid accepts no responsibility for ANY adverse effects as a result from downloading attached files. ALWAYS run an up-to-date virus scan and disable macros.

    Excel Video Tutorials / Excel Dashboards Reports


  6. #6
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,716

    Re: Save Cell Content As Separate File

    Yes, all cells will be saved, but isn't only one containing data? Not sure whether a .txt file can be saved as XML

  7. #7
    Join Date
    17th August 2006
    Posts
    27

    Re: Save Cell Content As Separate File

    When I try to save the file as.xml the whole sheet is being saved.
    Is there no way as to extract the content of a single cell into a text file and use it.

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Replies: 5
    Last Post: February 26th, 2008, 06:16
  2. Open Many Files & Save As Cell Content
    By stlstephens in forum EXCEL HELP
    Replies: 1
    Last Post: November 21st, 2006, 13:41
  3. Save As Cell Content in specified location
    By Ed. in forum EXCEL HELP
    Replies: 1
    Last Post: November 10th, 2005, 05:40
  4. Save as with filename = cell content
    By Notwenam in forum EXCEL HELP
    Replies: 2
    Last Post: November 23rd, 2004, 21:49
  5. Save file as cell content in specific dir
    By h_maarten in forum EXCEL HELP
    Replies: 4
    Last Post: August 24th, 2004, 18:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
porno