+ Reply to Thread
Results 1 to 7 of 7

Thread: Suppress workbook display

  1. #1
    aerotops
    Guest

    Suppress workbook display

    I am writing some VBE code which will take some data from a workbook,
    create another worknook and paste the data into this new workbook. I
    have about 100 workbooks to go through.
    For this code to run through all these workbooks, it takes a
    considerable amount of time. Also, the current workbook, whichever it
    is, keeps popping up and closing etc. I think this is a big loss
    performance wise and also irritating.
    Is there some way using which I don't have to Open up the workbooks on
    screen and just work with them and save them in memory?

    Thanks,
    Harsh.


  2. #2
    aerotops
    Guest

    Re: Suppress workbook display

    Also, is there some way to stop the workbooks from changing tabs
    visually on screen. The thing is, I don't need to see that stuff
    happen. It should just work in memory.
    I am kind of new at this stuff. So, any help would be much appreciated.
    Harsh.


  3. #3
    Tom Ogilvy
    Guest

    RE: Suppress workbook display

    Application.ScreenUpdating = False
    ' code the would update the screen
    Application.ScreenUpdating = True

    --
    Regards,
    Tom Ogilvy


    "aerotops" wrote:

    > I am writing some VBE code which will take some data from a workbook,
    > create another worknook and paste the data into this new workbook. I
    > have about 100 workbooks to go through.
    > For this code to run through all these workbooks, it takes a
    > considerable amount of time. Also, the current workbook, whichever it
    > is, keeps popping up and closing etc. I think this is a big loss
    > performance wise and also irritating.
    > Is there some way using which I don't have to Open up the workbooks on
    > screen and just work with them and save them in memory?
    >
    > Thanks,
    > Harsh.
    >
    >


  4. #4
    aerotops
    Guest

    Re: Suppress workbook display

    Thanks a lot.
    I also want to strip all special characters from filenames. Is there
    any quick fix for that? If not, how should I go about it?
    Harsh.


  5. #5
    aerotops
    Guest

    Re: Suppress workbook display

    Never mind. I found some code online which does this. I am pasting it
    here for future reference. The link is at:
    http://www.vba-programmer.com/Snippe..._Function.html

    Private Function DeleteWithin(ByVal TheString As String, ByVal BadTerm
    As String)
    START_PROCESS:
    If InStr(TheString, BadTerm) > 0 Then
    OldLength = Len(BadTerm)
    TotalLength = Len(TheString)
    InnerStringPos = InStr(TheString, BadTerm)
    LeftSide = Left(TheString, InnerStringPos - 1)
    RightSide = Right(TheString, TotalLength - (InnerStringPos +
    OldLength - 1))
    TheString = LeftSide & RightSide
    GoTo START_PROCESS
    Else
    DeleteWithin = TheString
    End If
    End Function


  6. #6
    Tom Ogilvy
    Guest

    Re: Suppress workbook display

    Perhaps something along the lines of:

    Dim s as String, s1 as String, i as Long
    Dim sChr as String, sChr1 as String
    Dim bk as Workbook
    set bk = Workbooks("???")
    s = bk.Filename
    s1 = ""
    for i = 1 to len(s)
    sChr = Mid(s,i,1)
    sChr1 = Ucase(sChr)
    if sChr <> sChr1 or sChr = "." or sChr = " " then
    s1 = s1 & sChr
    end if
    Next
    bk.SaveAs bk.Path & "\" & s1

    --
    regards,
    Tom Ogilvy


    "aerotops" wrote:

    > Thanks a lot.
    > I also want to strip all special characters from filenames. Is there
    > any quick fix for that? If not, how should I go about it?
    > Harsh.
    >
    >


  7. #7
    Tom Ogilvy
    Guest

    Re: Suppress workbook display

    Looping with a Goto; haven't seen that approach posted in years. Thanks for
    the flashback.

    --
    Regards,
    Tom Ogilvy


    "aerotops" wrote:

    > Never mind. I found some code online which does this. I am pasting it
    > here for future reference. The link is at:
    > http://www.vba-programmer.com/Snippe..._Function.html
    >
    > Private Function DeleteWithin(ByVal TheString As String, ByVal BadTerm
    > As String)
    > START_PROCESS:
    > If InStr(TheString, BadTerm) > 0 Then
    > OldLength = Len(BadTerm)
    > TotalLength = Len(TheString)
    > InnerStringPos = InStr(TheString, BadTerm)
    > LeftSide = Left(TheString, InnerStringPos - 1)
    > RightSide = Right(TheString, TotalLength - (InnerStringPos +
    > OldLength - 1))
    > TheString = LeftSide & RightSide
    > GoTo START_PROCESS
    > Else
    > DeleteWithin = TheString
    > End If
    > End Function
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0