Copy the Workbook from userform i.e, load the workbook path and copy the output workbook path

mahaboobk

New Member
Joined
Oct 12, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Hello All

Hopefully one of you awesome excel experts can help...

I have to create a userform with Commandbutton to navigate on (Get workbook path) selecting the "Abc" excel workbook, it should copy with all the sheets that are available in "Abc" workbook and paste that in different path as "Abc" workbook name (Put workbook path)
1. Source of "Abc" should be selcted from commandbutton
2. destination of "Abc" should be given code path
3. click submit button

-------------------------------------------------------------------
I the below code has issue but have included it below. Its got messup

Sub Get_copy_sheets_Click()

Dim fileToOpen As Variant
Dim wb As Workbook

Application.ScreenUpdating = False

FileToOpen = Application.GetOpenFilename(Title:="Browse for your File & Import Range", FileFilter:="Excel Files (*.xls*),*xls*")
If fileToOpen <> False Then
Set wb = Application.Workbooks.Open(fileToOpen)
'wb.Sheets(1).Range("A1:E20").Copy
'ThisWorkbook.Worksheets("SelectFile").Range("A10").PasteSpecial xlPasteValues
wb.Close False

Set wb = Application.Workbooks.GetOpenFilename
wb.Activate
ActiveWorkbook.Sheets("Any worksheet name or index").Copy
ActiveWorkbook.SaveAs "Path to the file"
ActiveWindow.Close
wb.Close

msgBox ("successfully copyed")
End Sub
 

Attachments

  • submit.JPG
    submit.JPG
    20.1 KB · Views: 11

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
please check the screen shot "Get and submit"
 

Attachments

  • Get and submit.JPG
    Get and submit.JPG
    34.4 KB · Views: 10
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top