Printout SolidEdge Draft by VB6

I try to print draft by VB6(SP6). But,I don't know to specify 'Sheets'.

 

  Dim Pname As String    'Printer.DeviceName

  Dim NumC As Integer    'Number of Copy

  Dim Ori As Integer    'Orientation

  Dim Psize As Integer    'PaperSize

  Dim CAB As Boolean    'ColorAsBlack

  Dim p As String      'Sheets

 

  Set seapp = GetObject(, "solidedge.application") .

  Set act = seapp.ActiveDocument

        .

        .

  Ori = 1      '1Smiley Tongueortrait  2:landscape

  Psize = 9      'Papersize ID  9:A4

  CAB = True

        .

  'Success

      act.printout Printer:=Pname, NumCopies:=1, Orientation:=Ori, PaperSize:=Psize, _

                      PrintRange:=3, Sheets:="1,3-5,8", ColorAsBlack:=CAB

 

  'Error

      p = "1,3-5,8"

      act.printout Printer:=Pname, NumCopies:=1, Orientation:=Ori, PaperSize:=Psize, _

                      PrintRange:=3, Sheets:=p, ColorAsBlack:=CAB

 

By SDK,all parameter is 'System.Object'.

 

What is problem ?

 

Posted by: Shoji Nakahara
Post date: 11/13/2012 9:44:23 AM

2 REPLIES

Printout SolidEdge Draft by VB6

I hit a similar problem at VB.NET but there it is solvable by using the Marshalling or the ToAsciiArray function (not sure witch of them it was, it's a year ago I last time tried this).

 

I think the variable p has to be of type IntPtr (Long in VB I think, pointer to a place in memory) and you have to convert the 16 Bit UTF string to 8 Bit ASCII Char Array.

 

Posted by: Stefan Barlage
Post date: 11/14/2012 6:32:38 AM

Printout SolidEdge Draft by VB6

Dear Stefan

 

Thank you for your help. I tried.

'p' sets 8bit char. VB6 does't have 'IntPtr' function, so It meets 'VarPtr' function,I think. But,It's not success.

 

'Error

  Dim pp as Long

  p = "1,3-5,8"

  pp = VarPtr(p)

  act.printout Printer:=Pname, NumCopies:=1, Orientation:=Ori, PaperSize:=Psize, _

                      PrintRange:=3, Sheets:=pp, ColorAsBlack:=CAB

 

I gave up by VB6. Then,not so cool procedure,I activate by every sheet, and printout by PrintRange sets Activesheet.

 

  acs.sheets.Item(i).Activate

  act.printout Printer:=Pname, NumCopies:=1, Orientation:=Ori, PaperSize:=Psize, _

                      PrintRange:=2, ColorAsBlack:=CAB

 

 

 

 

 

 

 

 

 

Posted by: Shoji Nakahara
Post date: 11/20/2012 3:37:15 AM