Migrating from VBA 6.x to 7.0
Hi there,
I have a rather comprehensive VBA project that generates a bucklet load of documents for my work.
As a feature, I have enabled a 'save work' mechanism, that works perfectly on VBA versions below 6.5 (6.5 and 7 causes errors).
The code is below
[vba]Open DocName For Output As FH
For Each PG In UserForm1.MultiPage1.Pages
For Each TB In PG.Controls
If TypeName(TB) = "TextBox" Then Print #FH, TB.Name & ":" & TB.TEXT
If TypeName(TB) = "CheckBox" Then Print #FH, TB.Name & ":" & TB.Value
If TypeName(TB) = "OptionButton" Then Print #FH, TB.Name & ":" & TB.Value
If TypeName(TB) = "ToggleButton" Then Print #FH, TB.Name & ":" & TB.Value
If TypeName(TB) = "ComboBox" Then Print #FH, TB.Name & ":" & TB.TEXT
Next TB
Next PG[/vba]
The problem is the line 'for each tb in pg.controls' fails with a 'method or data member not found error'.
If there is a fix for word 2010 for this, or if anyone can suggest an alternative method for saving work in progress from a VBA word project, I be very grateful.
Thanks
Ian