+ Reply to Thread
Results 1 to 12 of 12

Need Help in VBA save as TXT and XML formats

  1. #1
    Registered User
    Join Date
    08-05-2019
    Location
    New Delhi
    MS-Off Ver
    2013 and Office 365
    Posts
    14

    Need Help in VBA save as TXT and XML formats

    I am a newbee to VBA and am creating a project for myself. I have been able to do a lot of work but have got stuck on a few points. Any help would be appreciated.


    I have an excel sheet where i write down receipes. I have tried to create a macro wherein i want to save the receipe in a few different formats using a userbox.

    Currently my Range on the excel sheet is A1:B60 but i want to make it a dynamic one with maximum of 2 blank rows in between the 2 Headings of Title, Ingreadents and Method.

    Issue 1

    I have created a macro for save as text but it saves the complete Excel file as text. I need to just save the sheet and not the complete file as txt.

    Please Login or Register  to view this content.
    Issue 2

    I have created a macro for save as xml but again it saves the complete Excel file as xml. I need to just save the sheet and not the complete file as xml.

    Please Login or Register  to view this content.
    Last edited by amitesh9; 07-04-2020 at 07:22 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Need Help in VBA

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

    We would very much like to help you with your query, however the thread title does not really convey what your request is about. Tell us what you are trying to do, not how you think it should be done.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    08-05-2019
    Location
    New Delhi
    MS-Off Ver
    2013 and Office 365
    Posts
    14

    Re: Need Help in VBA save as TXT and XML formats

    Hope these changes help..

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Need Help in VBA save as TXT and XML formats

    Yes, thanks - much better.

  5. #5
    Registered User
    Join Date
    08-05-2019
    Location
    New Delhi
    MS-Off Ver
    2013 and Office 365
    Posts
    14

    Re: Need Help in VBA save as TXT and XML formats

    No response so far. Does no one have an answer to this situation I have

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Need Help in VBA save as TXT and XML formats

    Not as it stands, it seems - 93 views and no help suggests that either your request isn't clear or nobody has a solution. More likely the former, but I don't do VBA, so can't be sure. Hope this helps.

  7. #7
    Registered User
    Join Date
    08-05-2019
    Location
    New Delhi
    MS-Off Ver
    2013 and Office 365
    Posts
    14

    Re: Need Help in VBA save as TXT and XML formats

    Let me try to explain again. I want to save an Excel worksheet in text and XML format. Not the full file just a range of data in the worksheet.

    At present the code I have saves the entire file in text or XML format.

  8. #8
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,303

    Re: Need Help in VBA save as TXT and XML formats

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-05-2019
    Location
    New Delhi
    MS-Off Ver
    2013 and Office 365
    Posts
    14

    Re: Need Help in VBA save as TXT and XML formats

    Thank you torachan. The code for TXT worked like a charm.

    The code for XML is still saving it as XLSX.

  10. #10
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,303

    Re: Need Help in VBA save as TXT and XML formats

    Ensure filename1 does NOT have the ".xml" extension on it.
    Then try and force the save by also including the file format.
    It works in '2010' - should work with '2013' - not sure about '365'

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-05-2019
    Location
    New Delhi
    MS-Off Ver
    2013 and Office 365
    Posts
    14

    Re: Need Help in VBA save as TXT and XML formats

    Thanks That worked.

  12. #12
    Registered User
    Join Date
    08-05-2019
    Location
    New Delhi
    MS-Off Ver
    2013 and Office 365
    Posts
    14

    Re: Need Help in VBA save as TXT and XML formats

    Closing this thread as issue resolved. Thank you all for your help and support.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1