Doesn't do that for me. I commented out your .Activate and put in a message box to prove the active book, try it.
Sub OPENbook() 'Display a Dialog Box that allows to select a single file. 'The path for the file picked will be stored in fullpath variable With Application.FileDialog(msoFileDialogFilePicker) 'Makes sure the user can select only one file .AllowMultiSelect = False 'Filter to just the following types of files to narrow down selection options .Filters.Add "Excel Files", "*.xlsx; *.xlsm; *.xls; *.xlsb", 1 'Show the dialog box .Show 'Store in fullpath variable Dim fullpath As String fullpath = .SelectedItems.Item(1) End With 'It's a good idea to still check if the file type selected is accurate. 'Quit the procedure if the user didn't select the type of file we need. If InStr(fullpath, ".xls") = 0 Then Exit Sub End If 'Open the file selected by the user Workbooks.Open fullpath '.Activate -----> This is where I am having difficulties MsgBox ActiveWorkbook.Name 'FORMAT THE NEW WORKBOOK ' Rename the current sheet ActiveSheet.Name = "Commissions Data" ' Create, name, and color the other needed sheets Sheets.Add(After:=Sheets("Commissions Data")).Name = "Client Distribution" Sheets.Add(After:=Sheets("Client Distribution")).Name = "Issuer Distribution" Sheets("Commissions Data").Tab.ColorIndex = 3 Sheets("Client Distribution").Tab.ColorIndex = 4 Sheets("Issuer Distribution").Tab.ColorIndex = 5 Sheets("Commissions Data").Select 'SAVE 'Copy activesheet to the new workbook ActiveSheet.Copy MsgBox "This new workbook will be saved as Consolidated Commissions Statements.xlsx" 'Save new workbook as MyWb.xls(x) into the folder where ThisWorkbook is stored ActiveWorkbook.SaveAs ThisWorkbook.Path & "\Consolidated Commissions Statements", xlWorkbookDefault MsgBox "It is saved as " & ActiveWorkbook.FullName & vbLf & "Press OK to close it" ' Close the saved copy ActiveWorkbook.Close False End Sub






Reply With Quote