Results 1 to 9 of 9

Thread: Remake a vba script

  1. #1

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Remake a vba script

    Hello VB Members,

    I am total a newbeginner to VB.

    I got help for a time ago, from different people to make this function in VBA.

    The problem is I want to remake it to an application in Visual studio.

    Code:
    Sub Run_Two()
    
    Dim xPath As String
    
    myOrgName = Left(ThisWorkbook.Name, (InStrRev(ThisWorkbook.Name, ".", -1, vbTextCompare) - 1))
    
    xPath = Application.ActiveWorkbook.Path
    
    MkDir xPath & "\FileSheets"
    myLangPath = xPath & "\FileSheets"
    MkDir xPath & "\LangCombs"
    
    
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
        For Each xWs In ThisWorkbook.Sheets
        xWs.Copy
        Application.ActiveWorkbook.SaveAs Filename:=myLangPath & "\" & myOrgName & "_" & xWs.Name & ".xls"
        Application.ActiveWorkbook.Close False
        Next
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    End Sub
    Could someone help me or give me info about tutorials I googled some how to remake it as VB script

    Thank you in advance

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Remake a vba script

    remake it to an application in Visual studio.
    you want to make a compiled application written in vb.net or a VBS script?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Re: Remake a vba script

    Yes I would like to make an complied application in VB

  4. #4
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Remake a vba script

    How would you identify which workbook to process from VB? Obviously "ThisWorkbook" won't work.

  5. #5

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Loop through .xls files and sheets

    Hello VB Members,

    I should need a help with a code that

    first from a dialog window

    loop through all "*.xls" from a directory I select with the dialog window.

    then for each "*.xls" file the script loops through all sheets and alert sheet name then save.



    Could someone help me ?

    Thank you in advance

  6. #6
    Frenzied Member
    Join Date
    Oct 2012
    Location
    Tampa, FL
    Posts
    1,187

    Re: Loop through .xls files and sheets

    Cool concept, what did you try?

  7. #7
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: Loop through .xls files and sheets

    Please do not make multiple posts in various sub-forums that are asking for the same thing. Granted the description in this post is more descriptive of your goal than the one you made in the Office Forum (Remake a vba script) and the VBA code you posted there does not achieve this goal, but the intent was the same as you are asking for here.

    I have asked that the moderators consider merging your two threads.

  8. #8

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Re: Remake a vba script

    Hello vbfbryce,

    Well I would like to have a dialog window and I select a xls file so that workbook.

  9. #9
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,370

    Re: Remake a vba script

    I've merged two threads together, one from vbscript forum and the one from vb.net forum.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width