![]() |
Textbox Bug? Missing/delayed update of textbox filled via VBA
Hi,
I've found a strange behaviour regarding the Textbox object in a Excel 2003 worksheet (using Windows XP Prof.) The result my test code procudes is depending on whether I manually change the text inside the textbox object or not. The task(simplified): - I have a list containing X entries - I have a worksheet containing one textbox (called TEXT1); the worksheet is a kind of a template used to produce reports. - each of those entries should be written into the textbox using a loop in a VBA procedure and the worksheet should be printed in a file using the Printout method. Expected result: - there should be X files (*.PS) with a textbox containing one of the X list entries The problem: - Excel seems to have a problem to update the textbox before it sends the worksheet to the printer (looks like an application.screenupdating=false issue, but it isn't); all of the X files contain the first list entry only! - But: Excel seems to work as expected, if I manualle change the textbox's content just before I run the VBA code; each of the files contain a textbox showing a different value! = This behavior looks very strange to me. Hope that somebody could help me :) Thanks! Marc The code: - Textbox "TEXT1" should be on Sheet1 (using standard properties of textbox) Sub createReport() Dim i As Integer Application.ScreenUpdating = True For i = 1 To 5 Sheets(1).TEXT1.Text = "List entry: " & i printSheet (i) Next i End Sub Sub printSheet(i) ActiveSheet.PrintOut PrintToFile:=True, ActivePrinter:="Fineprint 2000", PrToFileName:="Test " & i & ".ps" End Sub ------------------------------- Marc Mueller Switzerland |
All times are GMT +1. The time now is 06:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com