Copy string value to windows clipboard from API
Copy string value to windows clipboard from API
(OP)
Is there a way to copy a string's value within a macro (value entered into an INPUTBOX) to windows clipboard? I'm using SolidWorks 2005 currently. The EditCopy function appears to be what I'm supposed to use, but my API help file is very unclear on how to use it, and I can't get it to work.
Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
http://sw.fcsuper.com/index.php






RE: Copy string value to windows clipboard from API
RE: Copy string value to windows clipboard from API
Use the link below to download a SolidWorks macro that gives you one solution to your problem. After you run the macro, open Notepad and do a paste. You should see the words Bye There.
http://w
SA
RE: Copy string value to windows clipboard from API
Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
http://sw.fcsuper.com/index.php
RE: Copy string value to windows clipboard from API
Thanks for your help. I had an itch to make an older simple macro a tiny bit more useful. Here's the result:
http:/
Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
http://sw.fcsuper.com/index.php
RE: Copy string value to windows clipboard from API
A suggestion: I would take out all the references to SolidWorks in the References dialog. I no longer have SolidWorks 2005 installed on my computer. The macro would not run until I unchecked Solidworks Utilities 2005 Type Library. This will allow the macro to run with any version of SolidWorks without the user having to figure out or complain to you why the macro will not run.
SA
RE: Copy string value to windows clipboard from API
CODE
Dim J As Integer
Dim dataStr As String
Dim buildStr As String
Dim tempStr As String
Dim Done As Boolean
''''''''''''''''''
Dim myData As New MSForms.DataObject 'This line was moved from the UserForm code
''''''''''''''''''
Sub main()
buildStr = ""
dataStr = "Use ALT + Keypad for special characters. Examples:" + Chr(13)
dataStr = dataStr + "171 = " + Chr(189) + " 172 = " + Chr(188) + _
" 241 = " + Chr(177) + Chr(13)
dataStr = dataStr + "250 = " + Chr(183) + " 253 = " + Chr(178) + _
" 248 = " + Chr(186) + Chr(13) + Chr(13)
dataStr = dataStr + "Choose OK to copy to clipboard." + Chr(13)
tempStr = buildStr
buildStr = InputBox(dataStr, "Editor Special Characters", tempStr)
If buildStr <> "" Then
''''''''''''''''''''''''
myData.SetText buildStr 'Remove the UserForm reference
myData.PutInClipboard 'from these two lines
''''''''''''''''''''''''
End If
End Sub
You do still have to include the Microsoft Forms reference, but you don't have to have an actual form in the macro.
RE: Copy string value to windows clipboard from API
Apparently I've been sold on a fantasy that SolidWorks is supposed to know when to use current libraries instead of past versions. I'm going to go through all of my macros to see where this might bring up an issue. Anyways, new update:
http:/
BTW, I'm still working on building my site up, I want to create a site that would've been helpful to me when I first started out making macros and customizing SolidWorks. Comments are welcome, and I will appreciate any public domain or freeware submissions or website links I might be missing (feel free to register on the site).
Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
http://sw.fcsuper.com/index.php
RE: Copy string value to windows clipboard from API
Has anyone else run into issues with libraries?
Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
http://sw.fcsuper.com/index.php
RE: Copy string value to windows clipboard from API
What is the exact name of the MS Forms library?
SA
RE: Copy string value to windows clipboard from API
RE: Copy string value to windows clipboard from API
Thanks, that DLL was not in my references dialog.
SA
RE: Copy string value to windows clipboard from API
Here is another option. Try this macro:
http://ww
It is based on code written by Bob Bedell that I found at :http://p2p.wrox.com/topic.asp?TOPIC_ID=15747
My first post with handleman's enhancement is much cleaner in my opinion but, if someone else was like me and did not have the FM20.dll loaded, this will eliminate you having to post solutions to possible problems with the macro not running.
SA
RE: Copy string value to windows clipboard from API
Your clipboard2 is a macro by its own right. Thank you.
Matt
Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
http://sw.fcsuper.com/index.php