Starchildren3317
Registered User.
- Local time
- Today, 09:46
- Joined
- Nov 30, 2010
- Messages
- 11
I have been racking my brain and surfing all over the net for an issue I am having.
I have a button control in a worksheet. When it is pressed it saves the current workbook, closes it, and then opens an new version of the workbook.
However it is not opening the file. It opens excel but the workbook doesnot open and I can not figure out why. Here is the code:
As pointed out however, it wont open the file. I get no error. It opens excel but that is it.
Any thoughts or suggestions?
I have a button control in a worksheet. When it is pressed it saves the current workbook, closes it, and then opens an new version of the workbook.
However it is not opening the file. It opens excel but the workbook doesnot open and I can not figure out why. Here is the code:
Code:
Private Sub CommandButton2_Click()
Dim fname As String
'The excel document is read only so the user must first save their work'
fname = Application.GetSaveAsFilename("C:\Program Files\IH_Workbench\LabResults", "Excel Macro-Enabled Workbook (*.xlsm),*.xlsm,")
ThisWorkbook.SaveAs Filename:=fname, FileFormat:=XlFileFormat.xlOpenXMLWorkbookMacroEnabled
'Closes the open workbook after saving
ThisWorkbook.Close
'Opens a new workbook
Workbooks.Open Filename:="C:\Program Files\IH_Workbench\LabResults.xlsm", UpdateLinks:=xlExcelLinks, ReadOnly:=True
End Sub
Any thoughts or suggestions?