how to read workbook name and default while inserting a sheet.
Results 1 to 2 of 2

Thread: how to read workbook name and default while inserting a sheet.
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    May 2019
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default how to read workbook name and default while inserting a sheet.

    Hi All,

    I am new to this forum and this is my first post.

    I have multiple text files, which I am locating using

    Code:
    Application.ActiveWorkbook.Worksheets
    once the text files are located, I open it using
    Code:
     Workbooks.OpenText Filename:= _
            sFolder & "/CONTRACT" _
            , Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
            xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
            Comma:=False, Space:=False, Other:=True, OtherChar:="*", FieldInfo:= _
            Array(Array(1, 5), Array(2, 1), Array(3, 1)), TrailingMinusNumbers:=True
    after I open the files, I move it to the current excel (excel name MC9.xlsm) using

    Code:
        Windows("CONTRACT").Activate
        Sheets("CONTRACT").Select
        Sheets("CONTRACT").Move After:=Workbooks("MC9.xlsm").Sheets(2)
    Here the file name is hard coded as "MC9.xlsm". I need to know how to get the workbook name and assign it in the below code

    Code:
    Sheets("CONTRACT").Move After:=Workbooks("MC9.xlsm").Sheets(2)
    Your support would be much appreciated.

    Regards,
    Zen.
    0 0
     

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    25,311
    Post Thanks / Like
    Mentioned
    435 Post(s)
    Tagged
    45 Thread(s)

    Default Re: how to read workbook name and default while inserting a sheet.

    Duplicate https://www.mrexcel.com/forum/excel-...ml#post5284348

    Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
    Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10
    0 0
     

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •