Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I'm in the process of trying to trash a userform before turning it into a add-in. Originally, part of my code held: Code: -------------------- Select Case rngNetwork Case 1 Set wrkbkUrl = Workbooks.Open(Filename:="P:\VBA training\Excel templates for Network stats\1 Network.xls") Sheets(Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec", "TempAnalysis", "Yearly summary")).Select Cells.Replace What:="1st Network", Replacement:=strNetwork1, LookAt:=xlPart, SearchOrder:=xlByColumns, MatchCase:=False Sheets("Jan").Select Range("C3").Select savewrkbkname = Application.GetSaveAsFilename(wrkbkname, fileFilter:="Excel Files (*.xls), *.xls") ActiveWorkbook.SaveAs Filename:=savewrkbkname -------------------- which did the job but one of the senarios I created was: What if the user cancelled the save before the save was completed? This highlighted a bug that saved the '1 Network.xls' as 'False' instead of cancelling the save. In order to try and remedy this I changed the code to: Code: -------------------- If (Application.GetSaveAsFilename(wrkbkname, fileFilter:="Excel Files (*.xls), *.xls")) Then savewrkbkname = Application.GetSaveAsFilename(wrkbkname, fileFilter:="Excel Files (*.xls), *.xls") Else: ActiveWorkbook.Close End If -------------------- However, this gave a 'Type Mismatch' error Does anyone have an insight to what's going wrong please? -- Daminc ------------------------------------------------------------------------ Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074 View this thread: http://www.excelforum.com/showthread...hreadid=507586 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
breaking during a macro run | Excel Discussion (Misc queries) | |||
breaking a link | Excel Programming | |||
Breaking Links | Excel Discussion (Misc queries) | |||
Breaking Links | Excel Discussion (Misc queries) | |||
breaking out of a loop | Excel Programming |