+ Reply to Thread
Results 1 to 13 of 13

need page break by asking the input file for page break to be done

  1. #1
    Registered User
    Join Date
    12-03-2008
    Location
    chennai
    Posts
    62

    need page break by asking the input file for page break to be done

    I need some more help from you.

    The code which you provided works fine no problem for a page break. I need to run the macro for the page break by asking the input file for page break to be done.

    For Example, If excel filename "A" contain the code which you have given need to ask to input the filename "B" and process need to be done in file "B".

    I have added some code to your code which you provided but it gives error message "1004" "Method 'Range' of object '_Application' failed" at following line :

    Set rng = oExcel.Range(Cells(2, 2), Cells(Rows.Count, 2).End(xlUp))

    Please Login or Register  to view this content.
    Last edited by saikumar; 12-10-2008 at 07:33 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Why are you creating a new instance of Excel?
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    12-03-2008
    Location
    chennai
    Posts
    62
    Quote Originally Posted by royUK View Post
    Why are you creating a new instance of Excel?
    Please Login or Register  to view this content.
    I thought that way i can solve my problem. if you have any other choice please let me know.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try the code that I posted

  5. #5
    Registered User
    Join Date
    12-03-2008
    Location
    chennai
    Posts
    62
    Quote Originally Posted by royUK View Post
    Try the code that I posted
    where is the code ? i think you don't understand th problem.

    Your code for page break work fine. what i required is that ? I receive the file which want to be page break with out adding the macro to it.

    so that what i plan to do is that, i will paste your existing page break code which you provided before in the file name "master". Current code will do a page break for "master" file, instead it need to ask the input file "transaction" file, the "transaction" file which need to page break. so that i can send the transaction file to client with page break on client id with out macro code in it.

    2 Files need to be used, first one is "master" file which will contain your macro with reqired code change. Second, file is that "transaction" file from client as source file which really need to have a page break depending on client ids.

    I feel you might have understand the problem.

    Thanks.
    Last edited by saikumar; 12-10-2008 at 06:27 AM.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I edited your code & posted it in Post #2, you have even quoted it!

  7. #7
    Registered User
    Join Date
    12-03-2008
    Location
    chennai
    Posts
    62
    Hi roy,

    I have pasted the code, but page break is not happening. I am attaching both the file. please execute and see. It doesn't through any error also

    Thanks.
    Attached Files Attached Files

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try this

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    12-03-2008
    Location
    chennai
    Posts
    62
    Welcome.

    But heading is not printing in all the pages.

    Thanks.

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by saikumar View Post
    Welcome.

    But heading is not printing in all the pages.

    Thanks.
    What do you mean? You can't detect whether a cell is a heading or not. You should standardise your workbooks so they either all have headings or don't.

    It would also save time if you stated your requirements fully in the first question
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    12-03-2008
    Location
    chennai
    Posts
    62
    I was saying that heading row need to printed or repeated in all the page break sheet.

    Initially, it was doing so. After various code modification, it has moved out.

    sorry for troubling you.

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The code does not affect that function, you need to set rows to print on each page. This addition will print Row1 on each sheet

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    12-03-2008
    Location
    chennai
    Posts
    62
    Thanks it works fine.

+ 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