Mathtype field code

V

vbaNOOB

Hi all,

I would like to unlink all field codes in the document except Mathtype.
I've check one of my document that Mathtype have field.type equal to 58, 51,
12

I'm new to Mathtype and field codes, I just wonder if I can identfy Mathtype
by checking the field.type?

Many Thanks
 
M

macropod

Hi vbaNOOB,

You could try something based on the UnlinkSpecificFields code at: http://gregmaxey.mvps.org/Field_Macros.htm. For example:
Sub UnlinkSpecificFields()
Dim pRange As Word.Range
Dim oFld As Word.Field
For Each pRange In ActiveDocument.StoryRanges
Do
For Each oFld In pRange.Fields
Select Case oFld.Type
Case 12, 51, 58
'Do Nothing
Case Else
oFld.Unlink
End Select
Next
Set pRange = pRange.NextStoryRange
Loop Until pRange Is Nothing
Next
End Sub

Do note, though, that there is no Word field type that corresponds with a Mathtype field, per se. The above code simply preserves
the type #s you've nominated.
 
V

vbaNOOB

Hi macropod,

Thanks for you info. I would like to ask more on the MathType problem.
I'm not familiar with the MathType equation. I just wonder is that enough to
those fields by only checking the type equal to 58,51 and 12? Will it be
chance that other MathType equation using other fields type? Or some other
stuff will have fields type using 58, 51, 12?

Many Thanks

macropod said:
Hi vbaNOOB,

You could try something based on the UnlinkSpecificFields code at: http://gregmaxey.mvps.org/Field_Macros.htm. For example:
Sub UnlinkSpecificFields()
Dim pRange As Word.Range
Dim oFld As Word.Field
For Each pRange In ActiveDocument.StoryRanges
Do
For Each oFld In pRange.Fields
Select Case oFld.Type
Case 12, 51, 58
'Do Nothing
Case Else
oFld.Unlink
End Select
Next
Set pRange = pRange.NextStoryRange
Loop Until pRange Is Nothing
Next
End Sub

Do note, though, that there is no Word field type that corresponds with a Mathtype field, per se. The above code simply preserves
the type #s you've nominated.

--
Cheers
macropod
[MVP - Microsoft Word]


vbaNOOB said:
Hi all,

I would like to unlink all field codes in the document except Mathtype.
I've check one of my document that Mathtype have field.type equal to 58, 51,
12

I'm new to Mathtype and field codes, I just wonder if I can identfy Mathtype
by checking the field.type?

Many Thanks
 
M

macropod

Hi vbaNOOB,
Will it be chance that other MathType equation using other fields type?
Or some other stuff will have fields type using 58, 51, 12?
I'd say yes to both.

--
Cheers
macropod
[MVP - Microsoft Word]


vbaNOOB said:
Hi macropod,

Thanks for you info. I would like to ask more on the MathType problem.
I'm not familiar with the MathType equation. I just wonder is that enough to
those fields by only checking the type equal to 58,51 and 12? Will it be
chance that other MathType equation using other fields type? Or some other
stuff will have fields type using 58, 51, 12?

Many Thanks

macropod said:
Hi vbaNOOB,

You could try something based on the UnlinkSpecificFields code at: http://gregmaxey.mvps.org/Field_Macros.htm. For example:
Sub UnlinkSpecificFields()
Dim pRange As Word.Range
Dim oFld As Word.Field
For Each pRange In ActiveDocument.StoryRanges
Do
For Each oFld In pRange.Fields
Select Case oFld.Type
Case 12, 51, 58
'Do Nothing
Case Else
oFld.Unlink
End Select
Next
Set pRange = pRange.NextStoryRange
Loop Until pRange Is Nothing
Next
End Sub

Do note, though, that there is no Word field type that corresponds with a Mathtype field, per se. The above code simply preserves
the type #s you've nominated.

--
Cheers
macropod
[MVP - Microsoft Word]


vbaNOOB said:
Hi all,

I would like to unlink all field codes in the document except Mathtype.
I've check one of my document that Mathtype have field.type equal to 58, 51,
12

I'm new to Mathtype and field codes, I just wonder if I can identfy Mathtype
by checking the field.type?

Many Thanks
 
V

vbaNOOB

um... At the moment, I will use this method.
I heard that there is api from Mathtype that can identify Mathtype equation.
But that would out of scope of this forum keke.

Thank you very much for your help

macropod said:
Hi vbaNOOB,
Will it be chance that other MathType equation using other fields type?
Or some other stuff will have fields type using 58, 51, 12?
I'd say yes to both.

--
Cheers
macropod
[MVP - Microsoft Word]


vbaNOOB said:
Hi macropod,

Thanks for you info. I would like to ask more on the MathType problem.
I'm not familiar with the MathType equation. I just wonder is that enough to
those fields by only checking the type equal to 58,51 and 12? Will it be
chance that other MathType equation using other fields type? Or some other
stuff will have fields type using 58, 51, 12?

Many Thanks

macropod said:
Hi vbaNOOB,

You could try something based on the UnlinkSpecificFields code at: http://gregmaxey.mvps.org/Field_Macros.htm. For example:
Sub UnlinkSpecificFields()
Dim pRange As Word.Range
Dim oFld As Word.Field
For Each pRange In ActiveDocument.StoryRanges
Do
For Each oFld In pRange.Fields
Select Case oFld.Type
Case 12, 51, 58
'Do Nothing
Case Else
oFld.Unlink
End Select
Next
Set pRange = pRange.NextStoryRange
Loop Until pRange Is Nothing
Next
End Sub

Do note, though, that there is no Word field type that corresponds with a Mathtype field, per se. The above code simply preserves
the type #s you've nominated.

--
Cheers
macropod
[MVP - Microsoft Word]


Hi all,

I would like to unlink all field codes in the document except Mathtype.
I've check one of my document that Mathtype have field.type equal to 58, 51,
12

I'm new to Mathtype and field codes, I just wonder if I can identfy Mathtype
by checking the field.type?

Many Thanks
 
P

Peter Jamieson

The SDK appears to be at

http://www.dessci.com/en/reference/SDK/

You would need the information in there to look inside the /result/ of
any field type that resolves to an object (I would have thought an {
EMBED } field in the case of MathType, but perhaps a LINK'ed object
whose type you could not deduce from the filename/extension) or images
of MathType equations.

The field types that you quote are
12: SEQ field (I would guess these fields are being used simply to
number the equations)
51: MacroButton - typically used either to fire a VBA macro or as a
text placeholder, but they may also "contain" an image which I guess
could be an Image of a Mathtype equation, or perhaps even an embedded
object
58. Embed. This could be any kind of embedded object - you wold need
the informaiton in the SDK to look at the header area of the /result/ of
the EMBED field to determine the object type.

Peter Jamieson

http://tips.pjmsn.me.uk
um... At the moment, I will use this method.
I heard that there is api from Mathtype that can identify Mathtype equation.
But that would out of scope of this forum keke.

Thank you very much for your help

macropod said:
Hi vbaNOOB,
Will it be chance that other MathType equation using other fields type?
Or some other stuff will have fields type using 58, 51, 12?
I'd say yes to both.

--
Cheers
macropod
[MVP - Microsoft Word]


vbaNOOB said:
Hi macropod,

Thanks for you info. I would like to ask more on the MathType problem.
I'm not familiar with the MathType equation. I just wonder is that enough to
those fields by only checking the type equal to 58,51 and 12? Will it be
chance that other MathType equation using other fields type? Or some other
stuff will have fields type using 58, 51, 12?

Many Thanks

:

Hi vbaNOOB,

You could try something based on the UnlinkSpecificFields code at: http://gregmaxey.mvps.org/Field_Macros.htm. For example:
Sub UnlinkSpecificFields()
Dim pRange As Word.Range
Dim oFld As Word.Field
For Each pRange In ActiveDocument.StoryRanges
Do
For Each oFld In pRange.Fields
Select Case oFld.Type
Case 12, 51, 58
'Do Nothing
Case Else
oFld.Unlink
End Select
Next
Set pRange = pRange.NextStoryRange
Loop Until pRange Is Nothing
Next
End Sub

Do note, though, that there is no Word field type that corresponds with a Mathtype field, per se. The above code simply preserves
the type #s you've nominated.

--
Cheers
macropod
[MVP - Microsoft Word]


Hi all,

I would like to unlink all field codes in the document except Mathtype.
I've check one of my document that Mathtype have field.type equal to 58, 51,
12

I'm new to Mathtype and field codes, I just wonder if I can identfy Mathtype
by checking the field.type?

Many Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top