Help On Some Code, Need an Automatic Save Script at end
Hi All,
Im currently after some help, I need this code to run in which it does just fine to hide selected worksheets, But at the end of this i need it to also save the workbook,
Can someone please help with a suggestion or code to assist,
Thankyou
Private Sub OKButton_Click()
Dim Notification As String
Dim i3 As Integer
Dim i As Integer
If ListBox1.ListCount = 0 Then
Notification = MsgBox("At least one sheet must remain visible.", vbOKOnly, "Unexpected Result")
Exit Sub
End If
MsgBox ListBox2.ListCount & " items will be hidden, " & ListBox1.ListCount & " items will be visible."
For i = 0 To ListBox1.ListCount - 1
Sheets(ListBox1.List(i)).Visible = True
Next i
For i = 0 To ListBox2.ListCount - 1
Sheets(ListBox2.List(i)).Visible = False
Next i
Unload Me
End Sub
- xpnciv's blog
- Login or register to post comments
- 2571 reads
Save
Have you tried:
ActiveWorkbook.Save
Best regards, ijb
Ian, I have tried
Ian,
I have tried
ActiveWorkbook.Save
But doesnt seem to do anything, Just skips and closes window.
FilePathAndName =
FilePathAndName = "C:\xxxx.xls" ' or whatever
activeworkbook.saveas (FilePathAndName)