+ Reply to Thread
Results 1 to 5 of 5

Importing, looping and saving (not really solved)

  1. #1
    Registered User
    Join Date
    08-18-2011
    Location
    Centurion South Africa
    MS-Off Ver
    Excel 2010
    Posts
    7

    Importing, looping and saving (not really solved)

    I have tried to look for the answers I need, but have not been able to find an exact answer.

    I have managed to make macros that suits my specific needs, but I still have a few glitches I need help with, let me try explain as best I can:

    I extract information from another program and export it into excel for easier reference and manipulation etc. Most of the time this is a two part process, as this program cannot give me all the info I need in one go. Anyway, the reports are always in a specific location and always have the same file extension (that is my 1st problem) when I run this specific macros, I need it to bring up a save prompt to change that file extension to a desired one, otherwise the 2nd half of my macros will not work and cause the program to crash. I have marked the spot where I need a user prompt to save inserted with a MsgBox "this is where the save function needs to be"

    Then, the next part of my problem is that I deal with variable report lengths ranging from less than 100 lines to more than 60 000 lines. The reports are in a set format all the way from the beginning to the end. I need to remove the page breaks in these reports to have the reports 100% the way I need them. The 1st page is 62 lines (line 1 to line 62) then, the page breaks are 9 lines, then from page to onwards each page is exactly 57 lines followed by a 9 line page break. The reports will range from Cell A to Cell S (never more for the final report that I want)

    I think I need a loop function? to remove those 9 line page breaks. This can be the last thing that the macros needs to complete, so it can be inserted right at the bottom of what I have so far.

    Please excuse my macros, I am quite new to this.

    Please Login or Register  to view this content.
    I have uploaded an example of what the report looks like after it is imported (currently) and if you scroll down you will see how I need it to be after the areas highlighted in yellow have been removed.
    Attached Files Attached Files
    Last edited by stevencohen; 11-25-2011 at 10:02 AM. Reason: additional info was inserted

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Importing, looping and saving

    Maybe the first part of your question can be answered by use of the Name As and FileCopy statements rather than opening the file and resaving it with a new name.

    For the second part, what do you mean by a 9 line page break? Is it just a gap of nine lines or is there actually a hard page break in there as well?

    An example report with before and after would be useful.
    Martin

  3. #3
    Registered User
    Join Date
    08-18-2011
    Location
    Centurion South Africa
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Importing, looping and saving

    Thanks for the reply Martin.

    I have attached an example of what my report looks like when it is imported & what I need it to look like (the areas in yellow are the gaps that need to be removed) they do not contain info that I need.)

    As far as the 1st part of your reply, I am still quite clueless & I just cannot get anywhere with Name as of File copy. Would you be able to give me a practical example? I would be extremely grateful!!!
    Thanks

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Importing, looping and saving

    Attachment doesn't seem to have worked.

    Example which creates a copy and then renames the copy.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-18-2011
    Location
    Centurion South Africa
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Importing, looping and saving

    I just cant get this code to work for me at all

    Thank you very much for your suggestions, I am going back to the drawing board to see if I can work out my bugs. I will post again if I still cant come right...

+ 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.6.0 RC 1