|
测试以下两个语句,都出现下图问题,solidworks不响应。
SwModel.SaveAs2 PDFFile, 0, True, False
Debug.Print SwModel.SaveAs4(PDFFile, 0, 0, E, W)
- Private Sub PrintPDF()
- Dim Xls As Excel.Application, Rng As Range
- Set Xls = Application
- Set Rng = Xls.Selection
- 'Debug.Print Rng.Address
- Dim R1 As Range, R2 As Range, R3 As Range, R4 As Range, R5 As Range, R6 As Range
- Set R1 = Xls.Range(Rng(1, 1))
- Set R2 = Xls.Range(Rng(2, 1))
- Set R3 = Xls.Range(Rng(3, 1))
- Set R4 = Xls.Range(Rng(4, 1))
- Set R5 = Xls.Range(Rng(5, 1))
- Set R6 = Xls.Range(Rng(6, 1))
- ''
- Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2
- 'Set SwModel = SwApp.ActiveDoc
- Dim E As Long, W As Long, PDFFile
- For ii = 1 To R5.Rows.Count
- Set SwApp = CreateObject("SldWorks.Application")
- SwApp.Visible = True
- Set SwModel = SwOpenFile(SwApp, R5(ii, 1))
- PDFFile = R6(ii, 1)
- Debug.Print SwModel.SaveAs4(PDFFile, 0, 0, E, W)
- Debug.Print ii, PDFFile
- SwModel.SaveAs PDFFile
- SwApp.CloseDoc SwModel.GetTitle
- SwApp.ExitApp
- Next ii
- Dim PDFRng As Range, MergePDF
- Set PDFRng = R6 '.Resize(2, R6.Columns.Count)
- MergePDF = Rng(0, 3)
- RngMergePDF PDFRng, MergePDF
- End Sub
- ''
- Private Sub testMergePDF()
- Dim Xls As Excel.Application, Rng As Range
- Set Xls = Application
- Set Rng = Xls.Selection
- 'Debug.Print Rng.Address
- Dim R1 As Range, R2 As Range, R3 As Range, R4 As Range, R5 As Range, R6 As Range
- Set R1 = Xls.Range(Rng(1, 1))
- Set R2 = Xls.Range(Rng(2, 1))
- Set R3 = Xls.Range(Rng(3, 1))
- Set R4 = Xls.Range(Rng(4, 1))
- Set R5 = Xls.Range(Rng(5, 1))
- Set R6 = Xls.Range(Rng(6, 1))
- Dim PDFRng As Range, MergePDF
- Set PDFRng = R6.Resize(3, R6.Columns.Count)
- MergePDF = Rng(0, 3)
- RngMergePDF PDFRng, MergePDF
- End Sub
复制代码 |
|