几何尺寸与公差论坛

 找回密码
 注册
查看: 604|回复: 0

【转帖】file save notify

[复制链接]
发表于 2009-4-13 10:54:11 | 显示全部楼层 |阅读模式
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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-24 02:48 , Processed in 0.035123 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表