Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've got some operational code for my project, and everything works as
long as there are no deviations from the norm. But, we all know deviations are going to happen. So, I want to be able to create an If-Then to check if the user does not select a workbook from the selection screen. Right now the code is: UF = Application.GetOpenFilename(FileFilter:="XML Files (*.xml)", Title:="This Weeks Projections for Marc") Workbooks.Open Filename:=UF Set wbUF = Workbooks.Open(Filename:=UF) UFFN = wbUF.Name Sheets("Marc").Select Sheets("Marc").Copy After:=Workbooks("Projection Summary.xls").Sheets("Summary") Windows(UFFN).Activate ActiveWindow.Close Obviously if the user clicks Cancel, I'm going to get error messages, so what value does the cancel button return that I can use in an If-Then statement? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
UF = Application.GetOpenFilename(FileFilter:="XML Files (*.xml)", _
Title:="This Weeks Projections for Marc") If UF < "" Then Workbooks.Open Filename:=UF Set wbUF = Workbooks.Open(Filename:=UF) UFFN = wbUF.Name Sheets("Marc").Select Sheets("Marc").Copy After:=Workbooks("Projection Summary.xls").Sheets("Summary") Windows(UFFN).Activate ActiveWindow.Close End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Jason Hancock" wrote in message ... I've got some operational code for my project, and everything works as long as there are no deviations from the norm. But, we all know deviations are going to happen. So, I want to be able to create an If-Then to check if the user does not select a workbook from the selection screen. Right now the code is: UF = Application.GetOpenFilename(FileFilter:="XML Files (*.xml)", Title:="This Weeks Projections for Marc") Workbooks.Open Filename:=UF Set wbUF = Workbooks.Open(Filename:=UF) UFFN = wbUF.Name Sheets("Marc").Select Sheets("Marc").Copy After:=Workbooks("Projection Summary.xls").Sheets("Summary") Windows(UFFN).Activate ActiveWindow.Close Obviously if the user clicks Cancel, I'm going to get error messages, so what value does the cancel button return that I can use in an If-Then statement? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks!
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Workbook_BeforeClose(Cancel As Boolean) - Cancel won't work | Setting up and Configuration of Excel | |||
msgbox cancel? | Excel Discussion (Misc queries) | |||
cancel save | Excel Discussion (Misc queries) | |||
Read Only - How to Cancel? | Excel Discussion (Misc queries) | |||
How to Cancel a Save? | Excel Programming |