Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Nov 2004
    Location
    Ottawa, Ontario, Canada
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    sprintf? (Excel VBA v6.3)

    I'm trying to print formatted text like you would do with printf. VBA lacks a printf and also the sprintf function. Does anybody have a routine which does the same function?

    I want to output multiple "stringlets" on the same line at specific column positions (vbTab doesn't guarantee a specific position).

    I have been using print #1, "blah"; Tab(40); "Blah blah";

    Unfortunately, the file descriptor "1" is local to the workbook containing the code so I can't use print routines in different workbooks to print to the same file.

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: sprintf? (Excel VBA v6.3)

    Look at the Print # statement. Each workbook can open the same file for append and print to it. However, they can't all have it open at the same time.
    Legare Coleman

  3. #3
    New Lounger
    Join Date
    Nov 2004
    Location
    Ottawa, Ontario, Canada
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: sprintf? (Excel VBA v6.3)

    Yes, thanks.
    That's exactly how I decided to solve it. I had already written the code with Print #1, ..... so it was not a big change to open for append instead of open for output.

Posting Permissions

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