Converting old MSWORD dialogs to VBA Forms

jimrward

Well-known Member
Joined
Feb 24, 2003
Messages
1,903
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
  8. 2003 or older
Platform
  1. Windows
does anyone have any code they have put together to convert old wordbasic dialog statements to VBA forms, the statements have been extracted to a txt file and read in line by line

I started to put together a VBA macro and all was well, TEXT, TEXTBOXES, CHECKBOXES all ok, until I came across WORDBASIC.GROUPBOX, which is now treated as a frame, it is easy to add a frame but it obscures all you have added to the form, so it needs to be added to the frame

My approach is possibly going to be one pass thru the data and create the frames, Frame1 to frameN, and store the sizes of the frames, then test the X, Y for new items and if they fit within a fram then add to the frame

My problem is if I have say 5 frames how can I address them with an index to add a control in the form of

set newtextbox = Frame(j).controls.add (("Forms.textbox.1")
With NewTextBox
If MyLab <> "" Then
.Name = MyLab
End If
.Top = Y
.Left = X
.Width = W
.Height = H
.Font.Size = 10
.Font.Name = "Tahoma"
.BorderStyle = fmBorderStyleSingle
.SpecialEffect = fmSpecialEffectFlat
End With
End If

it is not playing with the Frame(J) bit

any ideas

here is a sample of the data in case no one is familiar

WordBasic.BeginDialog 748, 433, "NOTE FOR FILE"
WordBasic.Text 29, 3, 516, 13, "Use the TAB key / Shift + TAB / Alt + letter to move between boxes"
WordBasic.Text 9, 18, 155, 13, "Name of Caller:", "Text1"
WordBasic.TextBox 169, 16, 262, 18, "TextBox1"
WordBasic.Text 480, 18, 65, 13, "File Ref:", "Text2"
WordBasic.TextBox 560, 16, 156, 18, "TextBox2"
WordBasic.Text 171, 44, 167, 13, "Date of Conversation:", "Text3"
WordBasic.TextBox 339, 41, 160, 18, "TextBox3"
WordBasic.Text 509, 44, 43, 13, "Time:", "Text4"
WordBasic.TextBox 559, 40, 160, 18, "TextBox4"
WordBasic.GroupBox 10, 65, 716, 130, "INFORMATION ON CALLER"
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,225,502
Messages
6,185,349
Members
453,287
Latest member
Emeister

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top