Results 1 to 2 of 2

Create new Workbook based on my sheet8 from original workbook as .xls if statement (2007)

Threaded View

  1. #1
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Create new Workbook based on my sheet8 from original workbook as .xls if statement (2007)

    Good morning,
    I have to come up with three processes for this code. One is in my Worksheet and the other two I will add in my Module.
    I need to create a new excel (.xls) workbook based on one of my “hidden” sheet from my original workbook based on my active.cell, as name, including another text, and open this workbook so that my user can insert information then saves it. (And not save as)

    I have the code to search my designated folder for if the file already exists, if it exist then open that file, if it doesn’t:

    - Create a new excel (.xls) workbook in my path based on my activecell and other text info;
    - Create the workbook with only one sheet;
    - Copy sheet(8) from my original workbook;
    - Paste the information on sheet(1) from the new workbook;
    - Leave both workbooks open.

    I have the current procedure but I am having trouble with the above procedures. I would need help creating a new workbook in my file path under my string names.

    
    Dim strRootPath As String
    Dim strUser As String, strReqNo As String, strPath As String, strFile As String
    
    Sub findfolder()
    
        strRootPath = "C:\"
        strUser = "Test_"
        strReqNo = Range("A" & ActiveCell.row)
        
        If strReqNo Like "*/[A-Z]" Then strReqNo = left(strReqNo, Len(strReqNo) - 2)
        
        strPath = strRootPath & strUser & strReqNo & ".xls"
        strFile = strUser & strReqNo
    
        If Dir(strPath) <> "" Then
            Workbooks.Open strPath
        Else
            MsgBox strFile & " Not Found " <----Replace code here
            'Workbooks.Add (1)
    '...
    '...
    '...
        End If
    
    End Sub
    I also have this proceedure in my sheet(1)

    Dim casms as long
        ElseIf Cells(ActiveCell.row, "E") >= 1000000 Then
            casms = MsgBox("Is this file in the CASMS folder?", vbYesNo)
            
            If casms = vbYes Then
            Application.EnableEvents = True
                Exit Sub
            Else
                Call findfolder
            Unload Me
            End If
            Application.EnableEvents = True
            Exit Sub
    Any idea how I would add all of this together?
    Last edited by Excelnoub; 07-17-2014 at 11:58 AM.
    Click the star icon in the lower left part of the contributor's post and add Reputation if we have helped you .

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Trying to create a 2nd workbook to mirror the first, to protect the original
    By zachdking in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-06-2013, 08:11 PM
  2. Saving workbook as notepad using cell data for filename & retaining original workbook name
    By peterkerr_13 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-26-2012, 08:07 AM
  3. [SOLVED] copy active sheet, create new workbook, name new workbook based on cell reference
    By jm0392 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-20-2012, 07:12 PM
  4. Create multiple sheets in new workbook based on credentials in source workbook
    By Julesdude in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-07-2011, 10:31 AM
  5. Replies: 1
    Last Post: 04-01-2006, 03:50 PM

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