Results 1 to 5 of 5

Opening and excel file using VBA

Threaded View

  1. #1
    Registered User
    Join Date
    10-20-2013
    Location
    Exeter, England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Opening and excel file using VBA

    Dear Friends,

    I have a spread sheet that won't do as I want it too. I do hope someone reading this can help me, the dead line is fast approaching.

    What it is, a userform being used as a password input box to reset the spreadsheet ready for the next year. What I need it to do is to save the workbook as it is, then 'save as' a different name, then reopen the original spreadsheet. Most works, it just wont reopen the original spreadsheet. I think I have tried pretty much everything and I just cant make it work. It saves the spreadsheet, saves as, closes the workbook (keeps excel open) but then thats it.

    The code as it stands is as follows.

    Private Sub continueres_Click()
    If Passwordyear.password.Text = "Password1" Then
    Passwordyear.password.Text = ""
    Passwordyear.Hide
    
    ActiveWorkbook.Save
    
    Dim dt As String, wbNam As String
    
    wbNam = "MMS_"
    dt = Format(CStr(Now), "dd_mm_yyyy")
    ActiveWorkbook.SaveAs FileName:=wbNam & dt
    
    ThisWorkbook.Close
    
    Application.Workbooks.Open ("Maintenance Management System (Draft - MPR) - Copy (Autosaved).xlsm")
    
    Else
    MsgBox "Incorect Password"
    Passwordyear.Hide
    
    End If
    
    
    End Sub

    Many thanks

    Michael
    Last edited by m.rigby55; 10-20-2013 at 07:25 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1