<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Getstring with default value in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/getstring-with-default-value/m-p/11411016#M2223</link>
    <description>&lt;P&gt;Thanks for the answer&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14801"&gt;@Ed__Jobe&lt;/a&gt;! I'll test soon.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Sep 2022 12:05:02 GMT</pubDate>
    <dc:creator>seabrahenrique</dc:creator>
    <dc:date>2022-09-09T12:05:02Z</dc:date>
    <item>
      <title>Getstring with default value</title>
      <link>https://forums.autodesk.com/t5/vba-forum/getstring-with-default-value/m-p/11399297#M2221</link>
      <description>&lt;P&gt;Hello guys!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that question may sound by a elemental point, but i can't finded a answer here with a vba...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, how can i do someting like that:&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/net/set-a-default-answer-to-editor-getstring/td-p/5677604" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/net/set-a-default-answer-to-editor-getstring/td-p/5677604&lt;/A&gt;&amp;nbsp;in a VBA code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in adance!&lt;/P&gt;</description>
      <pubDate>Sat, 03 Sep 2022 15:35:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/getstring-with-default-value/m-p/11399297#M2221</guid>
      <dc:creator>seabrahenrique</dc:creator>
      <dc:date>2022-09-03T15:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: Getstring with default value</title>
      <link>https://forums.autodesk.com/t5/vba-forum/getstring-with-default-value/m-p/11403887#M2222</link>
      <description>&lt;P&gt;VBA has the functions GetSetting and SaveSetting. They save values to the registry. This enables you to save an option that you can recover the next time the command is run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;GetSetting Function
      

Returns a key setting value from an application's entry in the Windows registry or (on the Macintosh) information in the application’s initialization file.

Syntax

GetSetting(appname, section, key[, default])

The GetSetting function syntax has these named arguments:

Part Description 
appname Required. String expression containing the name of the application or project whose key setting is requested. On the Macintosh, this is the filename of the initialization file in the Preferences folder in the System folder. 
section Required. String expression containing the name of the section where the key setting is found. 
key Required. String expression containing the name of the key setting to return. 
default Optional. Expression containing the value to return if no value is set in the key setting. If omitted, default is assumed to be a zero-length string (""). 



Remarks

If any of the items named in the GetSetting arguments do not exist, GetSetting returns the value of default.
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, you can just phrase your &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-4C5A1510-D470-4918-B2DC-FAAB9712BC33" target="_blank" rel="noopener"&gt;GetString&lt;/A&gt; prompt to include a default value. Just use the standard AutoCAD prompt string format. The structure for a prompt is "text message\ : \[optional keywords]", e.g.&amp;nbsp; You should also use &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-A47393D4-9F92-4815-B1E1-1D36FB3BEEA2" target="_blank" rel="noopener"&gt;GetKeyword&lt;/A&gt; to limit user input and make it easier for them to enter a choice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="visual-basic"&gt;Dim strChoice As String
'use GetKeyword here to se up your options.
strChoice = ThisDrawing.Utilty.GetString(False, "Enter your choice : [default/option1/option2] ")
Case Select strChoice 
  case = vbCr or "default" 
    'perform default action
  case = "option1"
  case = "option2"
End Select

'Combined with GetSetting you could have:
Dim strChoice As String
strChoice = Getsetting("MyApp","MyCommands","Command1")
If strChoice = "" Then strChoice = "default" 
'use GetKeyword here to se up your options.
strChoice = ThisDrawing.Utilty.GetString(False, "Enter your choice : [" &amp;amp; strChoice &amp;amp; "/option1/option2] ")
Case Select strChoice 
  case = vbCr or "default" 
    'perform default action
    SaveSetting("MyApp","MyCommands", "Command1", "default"
  case = "option1"
    'perform option1 action
    SaveSetting("MyApp","MyCommands", "Command1", "option1"
  case = "option2"
    'perform option2 action
    SaveSetting("MyApp","MyCommands", "Command1", "option2"
End Select&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 14:57:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/getstring-with-default-value/m-p/11403887#M2222</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2022-09-06T14:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Getstring with default value</title>
      <link>https://forums.autodesk.com/t5/vba-forum/getstring-with-default-value/m-p/11411016#M2223</link>
      <description>&lt;P&gt;Thanks for the answer&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14801"&gt;@Ed__Jobe&lt;/a&gt;! I'll test soon.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 12:05:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/getstring-with-default-value/m-p/11411016#M2223</guid>
      <dc:creator>seabrahenrique</dc:creator>
      <dc:date>2022-09-09T12:05:02Z</dc:date>
    </item>
  </channel>
</rss>

