×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Macro with an input dialog box with dropdown

Macro with an input dialog box with dropdown

Macro with an input dialog box with dropdown

(OP)
I everyone,

I am trying to make a macro which contains a dialog box, with a dropdown menu, with some predefined values. Any one have tried?

For example:

I would like to run the macro and the dialog box show the sizes of available threads diameters (M4, M5, M6, M8, M10...) Instead of write this values. It's possible to make this?

RE: Macro with an input dialog box with dropdown

you can do it using VBA and a Form

Eric N.
indocti discant et ament meminisse periti

RE: Macro with an input dialog box with dropdown

(OP)
Have you any example of this?

Many thanks

RE: Macro with an input dialog box with dropdown

google does

Eric N.
indocti discant et ament meminisse periti

RE: Macro with an input dialog box with dropdown

(OP)
Thanks

RE: Macro with an input dialog box with dropdown

(OP)
Yes you are right, i forgot to say that i'm trying to make that in a macro in Catia. My macro is written in CATScript, and i'm realizing that is not possible with CATScript. Do you suggest to change it to vba?

RE: Macro with an input dialog box with dropdown

Maybe you can modify this example...

file attached for testing..

CODE --> CATScript

Sub CATMain()
CreateProgressBar
Launch
End Sub

Sub CreateProgressBar()
    Dim ws, fso, Temp, PathOutPutHTML, fhta
    Set ws = CreateObject("wscript.Shell")
    Set fso = CreateObject("Scripting.FileSystemObject")
    Temp = ws.ExpandEnvironmentStrings("%Temp%")
    PathOutPutHTML = Temp & "\ModifyInstances.hta"
    Set fhta = fso.OpenTextFile(PathOutPutHTML, 2, True)
 
fhta.WriteLine "<html>"
fhta.WriteLine "<head>"
fhta.WriteLine "<title>Text</title>"
fhta.WriteLine "<HTA:APPLICATION "
fhta.WriteLine "ID=""objHTA"" "
fhta.WriteLine "APPLICATIONNAME=""Catia_Dropdown"" "
fhta.WriteLine "SCROLL=""NO"" "
fhta.WriteLine "SINGLEINSTANCE=""yes"" "
fhta.WriteLine "Caption = ""no"""
fhta.WriteLine ">"
fhta.WriteLine "</head>"
fhta.WriteLine "<script language=""VBScript"">"
fhta.WriteLine " Sub Window_Onload"
fhta.WriteLine "Dim intWidth, intHeight"
fhta.WriteLine "intWidth = 300"
fhta.WriteLine "intHeight = 100"
fhta.WriteLine "Me.ResizeTo intWidth, intHeight"
fhta.WriteLine "LoadDropDown"
fhta.WriteLine "End Sub"
fhta.WriteLine "Sub LoadDropDown"
fhta.WriteLine "For I=2 TO 10"
fhta.WriteLine "Set objOption = Document.createElement(""OPTION"")"
fhta.WriteLine "objOption.Text = I"
fhta.WriteLine "objOption.Value = I"
fhta.WriteLine "objDrop.Add(objOption)"
fhta.WriteLine "Next"
fhta.WriteLine "End Sub"
fhta.WriteLine "Sub SendToCatia"
fhta.WriteLine "Dim CATIA"
fhta.WriteLine "Set CATIA = GetObject(, ""CATIA.Application"")"
fhta.WriteLine "Dim oPartDocument "
fhta.WriteLine "Dim oPart"
fhta.WriteLine "Dim oCircularPattern "
fhta.WriteLine "Set oPartDocument = CATIA.ActiveDocument"
fhta.WriteLine "Set oPart = oPartDocument.Part"
fhta.WriteLine "Set oCircularPattern = oPart.FindObjectByName(""CircPattern.1"")"
fhta.WriteLine "oCircularPattern.AngularRepartition.InstancesCount.Value = objDrop.value"
fhta.WriteLine "oCircularPattern.CircularPatternParameters = catCompleteCrown"
fhta.WriteLine "oPart.Update"
fhta.WriteLine "window.close"
fhta.WriteLine "End Sub"
fhta.WriteLine "</script>"
fhta.WriteLine "<body>"
fhta.WriteLine "<select name=""objDrop"">"
fhta.WriteLine "</select>"
fhta.WriteLine "<input type=""button"" value=""Send To Catia"" name=""cATIABtn""  onClick=""SendToCatia"">"
fhta.WriteLine "<input id=""BtnExit""   type=""button"" value=""Cancel""   onclick=""window.close"">"
fhta.WriteLine "</body>"
fhta.WriteLine "</html>"
fhta.Close
End Sub



Sub Launch()
Set objShell = CreateObject("Wscript.Shell")
Temp = objShell.ExpandEnvironmentStrings("%Temp%")
PathOutPutHTML = Temp & "\ModifyInstances.hta"
objShell.Run (PathOutPutHTML), 1, True
End Sub 

______

Alex ,

RE: Macro with an input dialog box with dropdown

(OP)
Many thanks about this, it looks really what i need. Thanks by your help.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources