VBA Save File with automatic name

  • I have the below code to save the quotation, and it asks what to save the file as within a InputBox.


    Is there a way of this being automatically generated so Q0001, Q0002 and so on ...


  • Re: VBA Save File with automatic name


    Use a helper cell for a counter then assign the filename like this


    Code
    Range("A1") = Range("A1") + 1
    MyFilename = "Q" & Format(Range("A1"), "0000#")

    [FONT="Arial Black"][COLOR="blue"][SIZE="4"]Bill[/SIZE][/COLOR][/FONT]
    Tip: To avoid chasing code always use Option Explicit.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!