VBA Save File with automatic name

Important Notice


Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • 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!