WillEley
Newbie
I am setting up a VBA macro to automate some CST simulations. I am trying to create a custom dialogue to input all the settings needed for this automation and use an image for a visual aid. The custom dialog editor has an option to implement an image, but I have no idea how to actually select the image I want in the VBA code. I have looked all over the help guide and online but found no answers. Has anyone else managed to do this before and if so, how do you specify the filepath of the image you want to embed? Below is the function I have written which just shows the text in the dialogue box: "(Picture not found)" where the image should be. Thanks for any help, it is very much appreciated.
Code Visual Basic - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Function GetUserInput() As Boolean ' Establish User Dialogue Box to Get Inputs Begin Dialog UserDialog 1020,336,"Simulation Automater" Picture 100,10,810,150,"H:\My Documents\filepath...\image.png",3,.Image CancelButton 880,308,130,21 OKButton 740,308,130,21 GroupBox 10,260,320,70,"Export Results",.GroupBox1 GroupBox 10,170,320,80,"Eigenmode Simulation Position",.GroupBox2 GroupBox 340,170,670,120,"Optimisation Settings",.GroupBox3 Text 30,190,140,20,"Section Number (1-7)",.Text1 Text 360,190,100,30,"Parameter to Optimise",.Text4 ... TextBox 200,190,90,20,.section TextBox 200,220,90,20,.position ... End Dialog Dim dlg As UserDialog ' Set Default Values in User Dialogue Fields dlg.section = GetScriptSetting("section","1") dlg.position = GetScriptSetting("position","0") ... If (Not Dialog(dlg)) Then ' If the user left the dialog box without pressing OK GetUserInput = False Exit Else ' If the user properly left the dialog box by pressing OK GetUserInput = True ' Store the Optimisation Settings into the Database StoreScriptSetting("section",dlg.section) StoreScriptSetting("position",dlg.position) ... End If End Function
[MODERATOR ACTION]
- Adding Code or Syntax tags
Last edited by a moderator: