cancel
Showing results for 
Search instead for 
Did you mean: 

Generating business blueprint with shortcuts in Word 2007

Former Member
0 Kudos

Hi,

Was wondering if you have experienced problems generating the business blueprint in Solution Manager where Word 2007 is used? I have included the u201CInsert shortcutu201D option, which seems to cause the issue. (As this is not a problem when this option is not selected). When running the macro in 2007, an error causes Word to close. When recovering the document, the business blueprint is incomplete and the links are not generated correctly.

This problem does not occur when generating the blueprint, with the same option selected, for Word 2003.

I found a suggested solution here: http://support.microsoft.com/kb/282830. However, this did not solve the problem.

Any suggestions?

Thanks,

Hanne

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Hanne,

Please change the function InsertRef2kHyperLink to:

'***************************************************************

Private Sub InsertRef2kHyperLink(oRange As Range, strFileName As String, _

strOrigFilename As String)

'***************************************************************

Dim vAddress As Variant

Dim vSubAddress As Variant

Dim vScreenTip As Variant

Dim vTextToDisplay As Variant

vAddress = ""

vSubAddress = "S" & VBA.Left(strFileName, 32)

vScreenTip = ""

vTextToDisplay = strOrigFilename

'm_oDocument.Hyperlinks.Add Anchor:=oRange, Address:="", _

' SubAddress:="S" & VBA.Left(strFileName, 32), ScreenTip:="", _

' TextToDisplay:=strOrigFilename

m_oDocument.Hyperlinks.Add Anchor:=oRange, Address:=vAddress, _

SubAddress:=vSubAddress, ScreenTip:=vScreenTip, _

TextToDisplay:=vTextToDisplay

End Sub

MS Word 2007 crashes since "Address", "SubAddress", "ScreenTip" and "TextToDisplay" parameters have to provide with datatype "Variant" instead of "String" when running 2007.

Kind regards,

Horst

Former Member
0 Kudos

Thanks, that solved my problem! Both are rewared with points:)

Cheers,

Hanne

Answers (1)

Answers (1)

former_member190969
Active Contributor
0 Kudos

Hi Hanne,

the issue can be fixed by inserting the five green lines and outcommenting the red line in the subroutine sInsertHyperLink of the macro.

'***************************************************************

Private Sub sInsertHyperLink(sDoc As String)

'***************************************************************

Dim oRange As Range

Dim L_ADDRESS As Variant* *Dim L_SUBADDRESS As Variant

On Error GoTo err_sInsertHyperLink

If UCase(VBA.Left(VBA.LTrim(sDoc), 3)) = "WWW" Then

sDoc = "HTTP://" & sDoc

End If

L_ADDRESS = SDoc* *L_SUBADDRESS = ""

m_oDocument.Range.InsertParagraphAfter

Set oRange = m_oDocument.Range(m_oDocument.Range.End - 1)

u2018m_oDocument.Hyperlinks.Add Anchor:=oRange, Address:=sDoc, SubAddress:=""

m_oDocument.Hyperlinks.Add Anchor:=oRange, Address:=L_ADDRESS, SubAddress:=L_SUBADDRESS

oRange.Collapse Direction:=wdCollapseEnd

Set oRange = m_oDocument.Range(m_oDocument.Range.End - 1)

oRange.InsertParagraphAfter

Set oRange = Nothing

Exit Sub

err_sInsertHyperLink:

If m_bDebugMode = True Then

Stop

End If

Select Case Err.Number

Case 1249

Exit Sub

Case 102

Exit Sub

Case Else

End Select

End Sub

'***************************************************************

Former Member
0 Kudos

Hi Andreas,

Thanks for getting back to me!

Tried adding and commenting out your mentioned lines in the macro. However, this did not help in my case.

When running the macro, Word 2007 seems to crash after the bold line below:

'***************************************************************

Private Sub Set_giWordVersion()

'***************************************************************

Dim strVersion As String

Dim iVersion As Integer

Dim iPos As Integer

strVersion = Application.Version

iPos = VBA.InStr(1, strVersion, ".", vbTextCompare)

m_iWordVersion = CInt(VBA.Left(strVersion, (iPos - 1)))

End Sub

'***************************************************************

The macro never reaches "Private Sub sInsertHyperLink ()".

Is this something you have encountered before?!

All help will be greatly appreciated.

Kind regards,

Hanne

former_member190969
Active Contributor
0 Kudos

Hello Hanne,

Please check the content of variables strVersion and iPos before MS Word is crashing.

This should be strVersion = 12.0 and iPos = 3.

Kind regards,

Andreas

Former Member
0 Kudos

Hi Andreas,

Thank you for your input, and sorry for getting back to you so late.

After debugging a bit more, it seems that the programme crashes when calling:

m_oDocument.Hyperlinks.Add Anchor:=oRange, Address:="", _

SubAddress:="S" & VBA.Left(strFileName, 32), ScreenTip:="", _

TextToDisplay:=strOrigFilename

The m_oDocument.Hyperlinks.Add Anchor:=oRange, Address:=L_ADDRESS, SubAddress:=L_SUBADDRESS is not reached (see code below).

'***************************************************************

Private Sub InsertRef2kHyperLink(oRange As Range, strFileName As String, _

strOrigFilename As String)

'***************************************************************

m_oDocument.Hyperlinks.Add Anchor:=oRange, Address:="", _

SubAddress:="S" & VBA.Left(strFileName, 32), ScreenTip:="", _

TextToDisplay:=strOrigFilename

End Sub

'***************************************************************

Private Sub sInsertHyperLink(sDoc As String)

'***************************************************************

Dim oRange As Range

Dim L_ADDRESS As Variant

Dim L_SUBADDRESS As Variant

On Error GoTo err_sInsertHyperLink

If UCase(VBA.Left(VBA.LTrim(sDoc), 3)) = "WWW" Then

sDoc = "HTTP://" & sDoc

End If

L_ADDRESS = sDoc

L_SUBADDRESS = ""

m_oDocument.Range.InsertParagraphAfter

Set oRange = m_oDocument.Range(m_oDocument.Range.End - 1)

'm_oDocument.Hyperlinks.Add Anchor:=oRange, Address:=sDoc, SubAddress:=""

m_oDocument.Hyperlinks.Add Anchor:=oRange, Address:=L_ADDRESS, SubAddress:=L_SUBADDRESS

oRange.Collapse Direction:=wdCollapseEnd

Set oRange = m_oDocument.Range(m_oDocument.Range.End - 1)

<xxx>

'***************************************************************

However, an extract of the recovered business blueprint shows that the url is created. Although it is not the original filname url, which should be "1.1.1.1.1 Create BP" (instead of the 32 character string specified below).

1.1.1.3.1 Link create BP

SDE2E5D31A9B18FF1B54300145EB4162D

Any suggestions?

Kind regards,

Hanne