abitrandom82
New Member
- Joined
- May 16, 2024
- Messages
- 2
- Office Version
- 365
- 2021
- 2019
- Platform
- Windows
Hi All,
I created an excel sheet form with a macro that auto replacement texts specific excel cell entries into a designated word pad document.
Everything works perfectly until I saw that 3 of the cell ranges for the replacement texts cannot go over 251 characters or so. I found an old thread here:
that was helpful but I’m not sure how to implement the corrected code firefly posted on page 2 of this thread into my VB module.
below is a of part of my code and the areas called <<provider>> and <administrator>> and another one are the ranges that wont allow to go over 250 when the word pad document opens up (Debug Error 5854)
Option Explicit
Private Sub Create ()
Dim wb As Workbook
Dim ws As Worksheet, wsl As Worksheet, ws2 As Worksheet
Dim file As String
file = ActiveWorkbook.Path & "\" & "RMI.docx"
V
Dim word
_app As Object
Set word
app = CreateObject ("Word Application")
With word_app
End With
Dim word_ fichier As Object
Set word fichier - word
app. Documents. Open (file)
With word
Text Echeereder names.
End With
Dim word
Lichien2 As obJect
Set word fichier? = word
_app- Documents. Open (file)
With word
_fichier2. Range. Find
End With
Dim word
_fichiers As Object
Set wora_Eichiers = word_apr.Documents.Open(file)
With word
_Hachier3.Range,Fand
End With
Dim word fichier4 As Object
Set word fichier4 = word app. Documents. Open (file)
With word
fichier4. Range.Find
-Text = "<<Analyst>>"
I created an excel sheet form with a macro that auto replacement texts specific excel cell entries into a designated word pad document.
Everything works perfectly until I saw that 3 of the cell ranges for the replacement texts cannot go over 251 characters or so. I found an old thread here:
string parameter too long error
Hey all, I am running into this error which is making things difficult when trying to find and replace. The error is: Run-time error '5854': String parameter too long I take it there is a character limit when using the find and replace and if there is a way around it, it would be GREAT...
www.mrexcel.com
that was helpful but I’m not sure how to implement the corrected code firefly posted on page 2 of this thread into my VB module.
below is a of part of my code and the areas called <<provider>> and <administrator>> and another one are the ranges that wont allow to go over 250 when the word pad document opens up (Debug Error 5854)
Option Explicit
Private Sub Create ()
Dim wb As Workbook
Dim ws As Worksheet, wsl As Worksheet, ws2 As Worksheet
Dim file As String
file = ActiveWorkbook.Path & "\" & "RMI.docx"
V
Dim word
_app As Object
Set word
app = CreateObject ("Word Application")
With word_app
- Visible - True
- WindowState - 1 value for waWindowStateMaximize
End With
Dim word_ fichier As Object
Set word fichier - word
app. Documents. Open (file)
With word
Text Echeereder names.
- Replacement .Text - Range ("H21")
- Execute Replace:-2 value for wdReplaceAll
End With
Dim word
Lichien2 As obJect
Set word fichier? = word
_app- Documents. Open (file)
With word
_fichier2. Range. Find
- Text - "<<Provider>>"
- Replacement. Text = Range ("K21")
- Execute Replace:=2 value for wdReplaceA11
End With
Dim word
_fichiers As Object
Set wora_Eichiers = word_apr.Documents.Open(file)
With word
_Hachier3.Range,Fand
- Text - "<<Administrator>>"
- Replacement. Text = Range ("R21")
- Execute Replace:=2 value for wdReplaceAll
End With
Dim word fichier4 As Object
Set word fichier4 = word app. Documents. Open (file)
With word
fichier4. Range.Find
-Text = "<<Analyst>>"