Transformation Services
Not Sure Where to Start?
This specific issue arises when converting VB6 applications that use API calls to interact with programs from the Microsoft Office suite, such as Word , Excel or PowerPoint; the issue appears in in the upgraded code if the application is converted on a machien that does not have the Microsoft Office components installed.
There are two different options to remove the issue:
If the there are too many occurrences of this issue in the upgraded code, Option 1 is the recommended one, otherwise Option 2 will work.
Private Sub Form_Load()
Dim oWordApplication As Object
Set oWordApplication = GetObject(, "Word.Application")
If oWordApplication Is Nothing Then
Set oWordApplication = CreateObject("Word.Application")
End If
If oWordApplication Is Nothing Then
Err.Raise vbObjectError + 1, , " Word Application not installed on MVBS server "
End If
End Sub
Private Sub Form_Load()
Dim oWordApplication As Object = System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application")
If oWordApplication Is Nothing Then
'UPGRADE_WARNING: (7008) The ProgId could not be found on computer where this application was migrated.
oWordApplication = Activator.CreateInstance(Type.GetTypeFromProgID("Word.Application"))
End If
If oWordApplication Is Nothing Then
Throw New System.Exception((Constants.vbObjectError + 1).ToString() + ", , Word Application not installed on MVBS server ")
End If
End Sub
private void Form_Load()
{
object oWordApplication = Interaction.GetObject(String.Empty, "Word.Application");
if (oWordApplication is null)
{
//UPGRADE_WARNING: (7008) The ProgId could not be found on computer where this application was migrated.
oWordApplication = Activator.CreateInstance(Type.GetTypeFromProgID("Word.Application"));
}
if (oWordApplication is null)
{
throw new System.Exception((Constants.vbObjectError + 1).ToString() + ", , Word Application not installed on MVBS server ");
}
}
For this sample the EWI can be addressed by adding a COM Reference to Word changing the Activator.CreatorInstance invocation for a direct instantiation of new Word Application object:
oWordApplication = New Word.Application
8834 N Capital of Texas Hwy, Ste 302
Austin, TX 78759
Call us: +1.512.243.5754
info@wearegap.com