cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Error getting Sheet Format by Excel VBA

Prasad_G
10-Marble

Error getting Sheet Format by Excel VBA

Hi,

I am very new to Creo customization, I was looking to get number of sheets and sheet format of current drawing. I am able to get number of sheets but unfortunately I am not able to get Sheet Format.

 

Here is the code below

 

Set conn = asynconn.Connect("", "", ".", 5)
Set session = conn.session
Set model = session.CurrentModel
Set oSheetOwner = model
Dim oSheetallNumber As Long
oSheetallNumber = oSheetOwner.NumberOfSheets
Dim SheetFormat As IpfcDrawingFormat
Set SheetFormat = oSheetOwner.GetSheetFormat(1)

 

"SheetFormat" does not have any value in this case. 

3 REPLIES 3
remy
21-Topaz I
(To:Prasad_G)

Hi 

Although i'm more versed with Creo Toolkit (C language), i had a look to the documentation:

remy_0-1655197480144.png

 

Your code does not return any format. According to the documentation null returned value potentially means that the drawing does not have any format.
Can you make sure of that?

Prasad_G
10-Marble
(To:remy)

Hi Remy, 

 

Thanks a lot for the reply, but my drawing does have a format.  The similar code gives me the expected results when I run it in vb.net. I think there is some issue with the Creo libraries in Excel.

 

Also sometimes the excel and CREO exit unexpectedly when I run the code. I had a look at this article "https://www.ptc.com/en/support/article/CS356656" but did not find any luck in resolving this issue. Please do share your expertise if you have any information in this matter.

 

Thanks, 

Prasad

remy
21-Topaz I
(To:Prasad_G)

Hi you noted that your app works with Creo VB API and fails with EXCEL. You suspect that something is wrong with Creo Libraries in Excel, which is a fair findings.
The article you shared go fruther and informs that

  • The problem seems to be related to Microsoft Related Dlls and not related to Creo Parametric.

From your message it looks like you tried the workarounds suggested in the resolution.

Like said initially, my expertise lays more with Creo Toolkit (C) than with VB. 
If you need further insight, you might want to wait for a Creo VB API expert or file a Creo Toolkit Support case with this url: https://support.ptc.com/apps/case_logger_viewer/cs/auth/ssl/log 

Top Tags