|
file save notify
hi,
do you have a way to create a delay when you close your sw file.
my macro look like :
private function swdraw_filesavenotify(byval filename as string) as long
dim answer as integer
dim newanswer as string
answer = msgbox("this will save a pdf are you sure ?", vbyesno, "usnr")
if answer = 6 then
call test(newanswer)
end if
the problem is that my drawing is close before the save pdf run....
could you help me please!!!
end function
steph
i just tried an export and close using the following and it executes the saveas pdf first and then closes the document.
option explicit
sub main()
dim swapp as sldworks.sldworks
dim swpdfdata as sldworks.exportpdfdata
dim swdoc as sldworks.modeldoc2
dim swdraw as sldworks.drawingdoc
dim swmodeldocext as sldworks.modeldocextension
dim dexppath as string
dim boolstatus as boolean
dim sheetnames as variant
dim lerrors as long
dim lwarnings as long
set swapp = application.sldworks
set swdoc = swapp.activedoc
set swdraw = swdoc
sheetnames = swdoc.getsheetnames
set swmodeldocext = swdoc.extension
set swpdfdata = swapp.getexportfiledata(1)
dexppath = "c:\exportandclose.pdf"
'** prompt user if the sheets and the location/name are correct
if msgbox("exporting drawing sheets as " & dexppath & chr(13) _
& "is this correct?", vbyesno, "confirm save") = 6 then
'** export the drawing sheets as a pdf
boolstatus = swpdfdata.setsheets(swexportdata_exportallsheets, sheetnames)
boolstatus = swmodeldocext.saveas(dexppath, 0, 0, swpdfdata, lerrors, lwarnings)
if boolstatus then
msgbox "save as pdf successful" & vbnewline & dexppath
else
msgbox "save as pdf failed, error code:" & lerrors
end if
end if
swapp.closedoc (swdoc.gettitle)
end sub
edited: 10/23/2008 at 03:21 pm by blake dahle
check the doevents function
marc
quick |
|