Hi, I have written the following code but when it prompts the browser at GetSaveAsFilename, BOTH the Save and Cancel button Save the file. I have tried inserting a 'if vbsave then' command but then this creates both the save and the cancel button on the Browser to cancel. Please Help me find a way of getting the Save button to Save and the cancel button to Cancel..I am sure it is very simple but I am a learner in VBA !!
Gill
Private Sub Workbook_Open()
Dim MyFile, MyPath, MyName
mycheck = MsgBox("NOTE: The figures will not automatically update if you have opened this document from 'WIP'. To update the figures you MUST access the document through the Portal or the MReview Shortcut. Do you want to continue ? ", vbYesNo)
If mycheck = vbNo Then
ActiveWorkbook.Close
End If
myResp = MsgBox("If a C:\WIP folder exists, select 'YES' to save the file to that location. If you have not got a WIP folder on C:\ and would like to create one, also select 'YES'. (This will create the WIP folder and save the document there). To save elsewhere, select 'NO'.", vbYesNo)
If myResp = vbNo Then
filesavename = Application.GetSaveAsFilename("C:\Manual_MREVIEW_YYMM_Engagement", fileFilter:="Excel Files (*.xls), *.xls"
ActiveWorkbook.SaveAs
Exit Sub
End If
MyFile = Dir("C:\"
MyPath = "C:\WIP"
MyName = Dir(MyPath, vbDirectory)
If MyName <> "" Then
ActiveWorkbook.SaveAs ("C:\WIP\Manual_MREVIEW_YYMM_Engagement"
Else
MkDir "C:\WIP"
filesavename = Application.GetSaveAsFilename("C:\WIP\Manual_MREVIEW_YYMM_Engagement", fileFilter:="Excel Files (*.xls), *.xls"
ActiveWorkbook.SaveAs ("C:\WIP\Manual_MREVIEW_YYMM_Engagement"
End If
End Sub
Gill
Private Sub Workbook_Open()
Dim MyFile, MyPath, MyName
mycheck = MsgBox("NOTE: The figures will not automatically update if you have opened this document from 'WIP'. To update the figures you MUST access the document through the Portal or the MReview Shortcut. Do you want to continue ? ", vbYesNo)
If mycheck = vbNo Then
ActiveWorkbook.Close
End If
myResp = MsgBox("If a C:\WIP folder exists, select 'YES' to save the file to that location. If you have not got a WIP folder on C:\ and would like to create one, also select 'YES'. (This will create the WIP folder and save the document there). To save elsewhere, select 'NO'.", vbYesNo)
If myResp = vbNo Then
filesavename = Application.GetSaveAsFilename("C:\Manual_MREVIEW_YYMM_Engagement", fileFilter:="Excel Files (*.xls), *.xls"
ActiveWorkbook.SaveAs
Exit Sub
End If
MyFile = Dir("C:\"
MyPath = "C:\WIP"
MyName = Dir(MyPath, vbDirectory)
If MyName <> "" Then
ActiveWorkbook.SaveAs ("C:\WIP\Manual_MREVIEW_YYMM_Engagement"
Else
MkDir "C:\WIP"
filesavename = Application.GetSaveAsFilename("C:\WIP\Manual_MREVIEW_YYMM_Engagement", fileFilter:="Excel Files (*.xls), *.xls"
ActiveWorkbook.SaveAs ("C:\WIP\Manual_MREVIEW_YYMM_Engagement"
End If
End Sub