View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel[_460_] joel[_460_] is offline
external usenet poster
 
Posts: 1
Default Workbook does not Save from User Form


Oops!!! FileToSave is the variable used in the VBAhelp menu for the
function GetSaveFileName. You don't have it sedt to anything in your
code so it is equal to nothing which is equivalent to FALSE. You are
using strFile twice in the code for two different puposes. Also
GetSaveAsFilename doesn't save a file, it just gets the name. You have
to do the Save. Make the changes below


From

strFile = "SPEC " & TEO_No_1.Value _
& Space(1) & CLLI_Code_1.Value _
& Space(1) & CES_No_1.Value _
& Space(1) & TEO_Appx_No_2.Value

strFile = Application.GetSaveAsFilename( _ <======= This line is
wrong
InitialFileName:=strFile, _
fileFilter:="Excel Files (*.xls;*.xlsm;*.xlst), " & _
"*.xls;*.xlsm;*.xlst")

If FileToSave = False Then <======= Should match Variable here

MsgBox "The Save Method Failed, Eng Spec was not Saved", , "C.E.S."

<============================= Add

Exit Sub




To :

strFile = "SPEC " & TEO_No_1.Value _
& Space(1) & CLLI_Code_1.Value _
& Space(1) & CES_No_1.Value _
& Space(1) & TEO_Appx_No_2.Value

FileToSave = Application.GetSaveAsFilename( _ <======= This line is
wrong
InitialFileName:=strFile, _
fileFilter:="Excel Files (*.xls;*.xlsm;*.xlst), " & _
"*.xls;*.xlsm;*.xlst")

If FileToSave = False Then <======= Should match Variable here

MsgBox "The Save Method Failed, Eng Spec was not Saved", , "C.E.S."

Else <============================= Add
Thisworkbook.saveas FileName:=FileToSave
Exit Sub


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=166274

Microsoft Office Help