LineAT
Guest
Good morning.
I tried to ask chatgpt to create a macro that copies me the name of the active document in solid works in the notes and this is what he gave me:
option explicit
sub main()
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
set swapp = application.sldworks
set swmodel = swapp.activedoc
if not swmodel is nothing then
dim filename as string
filename = swmodel.getpathname
if len(filename) > 0 then
' copies the file name in the notes
dim dataobj as new msforms.dataobject
dataobj.settext filename
dataobj.putinclipboard
end if
end if
end
It is actually one of the options I give, but they always have the same problem or "types" or "objects" not declared or invalid.
can you correct it or understand what's wrong?
I tried to ask chatgpt to create a macro that copies me the name of the active document in solid works in the notes and this is what he gave me:
option explicit
sub main()
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
set swapp = application.sldworks
set swmodel = swapp.activedoc
if not swmodel is nothing then
dim filename as string
filename = swmodel.getpathname
if len(filename) > 0 then
' copies the file name in the notes
dim dataobj as new msforms.dataobject
dataobj.settext filename
dataobj.putinclipboard
end if
end if
end
It is actually one of the options I give, but they always have the same problem or "types" or "objects" not declared or invalid.
can you correct it or understand what's wrong?