Copy sheet from one workbook to another book without opening the excel using vbscript

Is there any possible to do the following execution using vbscript

1. Generally, we receive business data excel doc .xls or .xlsx (which doesn't have my code/macros in it)
2. I have created Master sheet (.xlsm) which has macros in it and no data.
3. Whenever i receive business data (1): i have to copy that into master sheet (2),SaveAs (.xls) as date stamp and run macros into the new one.
4. Master sheet should not be open while copying because i have wrote some line code in "BeforeClose" method in master sheet.
Please anyone help me out on this to achieve the above. Below is the my code
Dim objworkbookv
Dim objworkbookm
Dim objworkbookd
Dim ws
Set objExcel = CreateObject("Excel.Application")
Set fso = CreateObject("Scripting.FileSystemObject")
objExcel.Visible = False
filePath = BrowseForFile()
If filePath = "" Then
MsgBox "You have not selected the file", vbcritical
Else
Set objWorkbookv = objExcel.Workbooks.Open(filePath)
Set objWorkbookm =
objExcel.Workbooks.Open("C:\Users\Arvind\Desktop\test\Master_Copy.xls")
For Each ws In objWorkbookv.Sheets
    ws.Copy objWorkbookm.Sheets(objWorkbookm.Sheets.Count)
Next
objWorkbookv.Close False
filepath = left(filepath,instr(1,filepath,".xls")-1)
objWorkbookm.SaveAs (filepath & "_" & timeStamp & ".xls")
objWorkbookm.Close SaveChanges = True
Set objworkbookd = objExcel.Workbooks.Open(filepath & "_" & timeStamp &  ".xls")
objExcel.Visible = True
objworkbookd.sheets(1).Select
objworkbookd.sheets(1).activate
with objExcel
.DisplayAlerts = True
.Quit
End With
Set objExcel = Nothing
Msgbox "you can start copying the coords"
End If

Function BrowseForFile()
BrowseForFile = CreateObject("WScript.Shell").Exec( _
"mshta.exe ""about:<input type=file id=f>" & _
"<script>resizeTo(0,0);f.click();new
ActiveXObject('Scripting.FileSystemObject')" & _
".GetStandardStream(1).WriteLine(f.value);close();</script>""" _
).StdOut.ReadLine()
End Function

Function timeStamp()
Dim t
t = Now
timeStamp = Year(t) & "-" & _
Right("0" & Month(t),2)  & "-" & _
Right("0" & Day(t),2)  & "_" & _  
Right("0" & Hour(t),2) &  "_" & _
Right("0" & Minute(t),2) '    '& _    Right("0" & Second(t),2)
End Function
Lokanath KAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fabrice LambertConsultingCommented:
Hi,

What you describe can be achieved by querying the workbook with an SQL query, this won't trigger any VBA.
Public Sub getWorksheetData(ByVal srcFilePath As String, ByVal worksheetName As String, ByRef targetCell As Excel.Range)
    Const adOpenStatic = 3
    Const adLockReadOnly = 1
    Const adStateClosed = 0
    Dim cn As Object        '// ADODB.Connection
    Set cn = CreateObject("ADODB.Connection")
    cn.ConnectionString = getConnectionString(srcFilePath)
    cn.Open
    
    Dim SQL As String
    SQL = "SELECT *" & vbCrLf
    SQL = SQL & "FROM [" & worksheetName & "$];"
    
    Dim rs As Object        '// ADODB.Recordset
    Set rs = CreateObject("ADODB.Recordset")
    rs.Open SQL, cn, adOpenStatic, adLockReadOnly
    
    targetCell.CopyFromRecordset rs
    rs.Close
    Set rs = Nothing
    cn.Close
    Set cn = Nothing
End Sub

Private Function getConnectionString(ByVal path As String) As String
    getConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & path & ";Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"";"
End Function

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fabrice LambertConsultingCommented:
Solution provided
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.