on 04-20-2009 8:02 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
'***************************************************************
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.