Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #16  
Old 03-21-2022, 01:01 AM
gorkac gorkac is offline Content blocks stop working when changing file path Windows 10 Content blocks stop working when changing file path Office 2019
Banned
Content blocks stop working when changing file path
 
Join Date: Jul 2021
Location: Usa
Posts: 62
gorkac is on a distinguished road
Default

I have managed to replace:
Code:
Application.Templates( _"L:\06. MODELOS DE DOCUMENTOS\01 ATESTADOS\ACCIDENTES DE CIRCULACIÓN\BAEI\Informe Tecnico\BAEI - INFORME TÉCNICO.dotm"). _
BuildingBlockEntries("INICIO Y EXPOSICION DE HECHOS").Insert Where:=Selection.Range, RichText _
:=True
by:
variable Ruta in:
Code:
Application.Templates("Ruta"). _
            BuildingBlockEntries("INICIO Y EXPOSICION DE HECHOS").Insert Where:=Selection.Range, RichText _
            :=True
Using this simple code. Now I will upload more information on how I have organized the content blocks, etc.

Code:
Sub Ruta()
Dim InicioRuta As String
Dim FinalRuta As String
Dim Ruta As String
Dim NumeroAT As String
InicioRuta = "L:\02.- ATESTADOS 2022\ATESTADOS PAMPLONA\2. ACCIDENTES CIRCULACION"
FinalRuta = "BAEI – INFORME TECNICO.docm"
NumeroAT = "\AT-1234568\"     'Here I will create a dialog for the user to indicate what AT-xxxxxxx number is going to be given.
Ruta = InicioRuta + NumeroAT + FinalRuta
MsgBox Ruta 'It returns the path, so this works for now.
End Sub
Here, MsgBox Ruta, effectively returns the path but when putting this Ruta variable where I indicated above, it does not have the effect, but it does not give an error either.

I have tried to put the same path with and without variable. With no variable, BuildingBlockEntries("INICIO Y EXPOSICION DE HECHOS") is inserted. But with the variable Ruta, no.

Let me explain, this code:


Code:
Application.Templates( _"L:\06. MODELOS DE DOCUMENTOS\01 ATESTADOS\ACCIDENTES DE CIRCULACIÓN\BAEI\Informe Tecnico\BAEI - INFORME TÉCNICO.dotm"). _
BuildingBlockEntries("INICIO Y EXPOSICION DE HECHOS").Insert Where:=Selection.Range, RichText _
:=True
is the same as:
Code:
Application.Templates("Ruta"). _
            BuildingBlockEntries("INICIO Y EXPOSICION DE HECHOS").Insert Where:=Selection.Range, RichText _
            :=True
if in the Ruta macro I put these values:
Code:
Sub Ruta()
Dim InicioRuta As String
Dim FinalRuta As String
Dim Ruta As String
Dim NumeroAT As String
InicioRuta = "L:\06. MODELOS DE DOCUMENTOS\01 ATESTADOS\ACCIDENTES DE CIRCULACIÓN\BAEI"
FinalRuta = "BAEI – INFORME TECNICO.docm"
NumeroAT = "\Informe Tecnico\"     'Here I will create a dialog for the user to indicate what AT-xxxxxxx number is going to be given.
Ruta = InicioRuta + NumeroAT + FinalRuta
MsgBox Ruta 'It returns the path, so this works for now. The message returns L:\06. MODELOS DE DOCUMENTOS\01 ATESTADOS\ACCIDENTES DE CIRCULACIÓN\BAEI\Informe Tecnico\BAEI - INFORME TÉCNICO.dotm
End Sub
This doesn't give an error, but it doesn't do anything. HELP

Code:
Application.Templates("Ruta"). _
            BuildingBlockEntries("INICIO Y EXPOSICION DE HECHOS").Insert Where:=Selection.Range, RichText _
            :=True
We are close to getting it

Last edited by gorkac; 03-21-2022 at 04:33 AM. Reason: More info
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mapped Content Controls in Building Blocks? Charles Kenyon Word 6 05-21-2021 05:40 PM
Stop hyperlink to a file from changing address - causes problems with pdf c.davidson Word 1 09-15-2020 11:11 PM
Content blocks stop working when changing file path New building blocks have stopped working (Word 2016) Genericname1111 Word 0 05-20-2020 04:17 PM
Content blocks stop working when changing file path Get image path from content control field - NO VBA possible thoerzer Word 5 10-10-2019 12:10 AM
Changing Absolute path to Relative in a Macro MrKim Excel Programming 13 01-26-2019 02:18 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:59 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft