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?
Bookmarks