Access vba to move sheets

Hi,
I am looking for an access vba script to move a tab on a workbook before another by its names. Please see below code

Public Sub Volume_SelectA1()
Dim ObjExcel
FilDatCretd = FileDateTime("N:\abcd\abc.txt")
   
   
    Set ObjExcel = CreateObject("Excel.Application")
    ObjExcel.Visible = False
    ObjExcel.Workbooks.Open "C:\efg\efg.xlsx"
   
   
    Set ObjSheet = ObjExcel.ActiveWorkbook.Worksheets("DateTimeStamp")
    ObjSheet.Activate
    'Set ObjSheet = ObjExcel.ActiveWorkbook.Worksheets(1)
    'ObjSheet.Activate

        ObjSheet.Range("A1", "A2").HorizontalAlignment = xlCenter
        ObjSheet.Range("A1", "A2").VerticalAlignment = xlCenter
        ObjExcel.ActiveWindow.DisplayGridlines = False
        ActiveSheet.Move Before:=Sheets("Sheet6") <--------------Error message
         
    With ObjSheet
        .Rows("1:1").Font.Size = 12.75
        .Range("1:1").Font.Bold = True
        .Range("A1").Font.Color = RGB(255, 255, 255)
        .Range("A1").Interior.Color = RGB(0, 81, 142)
        .Range("A1") = "Last Time Data Updated"
        .Range("A2") = Format(FilDatCretd, "dd/mmm/yyyy hh:mm")
        .Range("A1").EntireColumn.AutoFit
        .Range("A1").Select
        End With
       
        ObjSheet.UsedRange.BorderAround LineStyle:=xlDouble, Weight:=xlThick, ThemeColor:=4
                       
    ObjExcel.ActiveWorkbook.Save
    ObjExcel.ActiveWorkbook.Close
    ObjExcel.Quit
   
    Set ObjExcel = Nothing
    Set ObjSheet = Nothing
    Set FilDatCretd = Nothing
End Sub

Thank you
A
Asatoma SadgamayaAnalystAsked:
Who is Participating?
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.

Daniel PineaultPresident / Owner CARDA Consultants Inc.Commented:
The basic concept is
Sheets("Sheet2").Move Before:=Sheets("Sheet1")

Open in new window



Your best bet is to record a Macro and then review the generated code.
Asatoma SadgamayaAnalystAuthor Commented:
Sorry D that is not working for me
Sam JacobsDirector of Technology Development, IPMCommented:
If you have renamed the worksheets, make sure that you use the new name(s) in the move.
Daniel PineaultPresident / Owner CARDA Consultants Inc.Commented:
At the beginning use
ObjExcel.Sheets("DateTimeStamp").Move Before:=ObjExcel.Sheets("Sheet6")

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
Asatoma SadgamayaAnalystAuthor Commented:
Thanks D. Your code worked.
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
Microsoft Access

From novice to tech pro — start learning today.