+ Reply to Thread
Results 1 to 4 of 4

VBA - using save as without opening the file and desactivate alerts

  1. #1
    Registered User
    Join Date
    02-01-2017
    Location
    Lisboa
    MS-Off Ver
    2010
    Posts
    81

    VBA - using save as without opening the file and desactivate alerts

    Hello,

    In this forum I found a solution to create a code to export a table and save it as a CVS file:
    (https://www.excelforum.com/excel-pro...ml#post5016460)

    The code export a table and activates the save as dialog box for the user choose the destination where it wants to save the file. The problem is that after saving the file, the user always need to close the file that was open in the middle of the process, and also a dialog box appears asking the user if he wants to save the changes in the file.
    Is there any way to just save the cvs file without opening the files and avoid the dialog box alerts at the end of the process?

    I attached the file with the example.

    Any suggestions would be greatly appreciated!

    Thank you in advance
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA - using save as without opening the file and desactivate alerts

    Hi,

    Just put

    awb.Close

    before

    Application.DisplayAlerts = True
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    02-01-2017
    Location
    Lisboa
    MS-Off Ver
    2010
    Posts
    81

    Re: VBA - using save as without opening the file and desactivate alerts

    Hello Richard,

    I put "awb.Close" before "Application.DisplayAlerts = True" and at the beginning seemed to work well but when I open the cvs file, that I saved, all the data appear in the first column separate by commas. I need to save the data in a cvs file but delimited in three columns (Customer ID, Revenue, ID SalesPerson).
    I made a test with my first vba code and after closing the cvs file, it appears always a dialog box asking if “I wish to save the changes in the cvs file”: if I choose “yes” when I open the cvs file that I saved, the data is delimited in three columns, if I choose “no” when I open the cvs file the data appear all in the first column…


    Kind regards

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA - using save as without opening the file and desactivate alerts

    ...maybe the following

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 02-03-2019, 02:55 AM
  2. having problems opening file after VBA save
    By clammastak in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2015, 06:08 PM
  3. Auto save Excel ODBC Connection to data source without opening file
    By newbie4 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-01-2015, 01:37 PM
  4. [SOLVED] Automatic save as backup when opening file
    By Christopherdj in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 01-29-2015, 08:36 PM
  5. How to disable application alerts On workbook opening!
    By Korjaaja in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-08-2014, 12:11 PM
  6. Copy a sheet and save as new file, without opening the file
    By Chinnick in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-13-2009, 05:00 PM
  7. [SOLVED] Opening file without alerts
    By Revolvr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-24-2006, 05:20 PM

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