Excel VBA - Why is my "Save As" not working? -


i have vba script in place if cell blank excel prompt file saved.

this ensure template not altered. however, when user clicks save in "save as" dialogue box, file not save.

this code using:

if worksheets("input").range("e2").value = ""     application.enableevents = false     application.getsaveasfilename initialfilename:="\\ac35542\problem management\action plans\changeme.xlsm", filefilter:="excel macro-enabled workbook (*.xlsm),*.xlsm"     application.enableevents = true     msgbox "please ensure fill in problem reference number, problem title, , select contract", vbexclamation, "pr reference & title"     worksheets("input").select     range("e2").select end if 

why file not saving?

as follow msdn

application.getsaveasfilename displays standard save dialog box , gets file name user without saving files..

use 1 instead:

dim filesavename if worksheets("input").range("e2").value = ""     application.enableevents = false     filesavename = application.getsaveasfilename(initialfilename:="\\ac35542\problem management\action plans\changeme.xlsm", filefilter:="excel macro-enabled workbook (*.xlsm),*.xlsm")     application.enableevents = true      if filesavename <> "false"         application.displayalerts = false         thisworkbook.saveas (filesavename)         application.displayalerts = true     end if      msgbox "please ensure fill in problem reference number, problem title, , select contract", vbexclamation, "pr reference & title"     worksheets("input").select     range("e2").select end if 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -