Saltar al contenido
PROGRAMAR EN VBA MACROS DE EXCEL

Como copiar varias tablas vinculadas de Excel a Word


(adsbygoogle = window.adsbygoogle || []).push({});

Es posible que cuando se realiza un informe con datos que se encuentra en Word normalmente se base en varias tablas de Excel y no en solamente una tabla con datos, cuyo ejemplo se presentó en el post anterior; para solucionar el tema proporciono esta macro que permite copiar o exportar varias tablas vinculadas de Excel a Word, es decir que cuando se cambie algún dato en las tablas de Excel basta con actualizar el vínculo en Word para que se actualicen los datos.

Otros post relacionados con macros que permiten manejar Word desde Excel:

Como crear un archivo de Word con Excel
Como abrir un archivo de Word con Excel
Como conectar Excel con Word crear archivo e insertar texto en Word
Como dar formato a texto de Word desde Excel 
Como abrir modificar e imprimir archivo de Word con macro desde Excel
Como modificar una plantilla de Word con macro de Excel
Como rellenar pagare con datos de Excel conectando con Word
Como crear cartas en Word con clientes listados en Excel
Como copiar tablas o cuadros de Word a Excel
Como exportar tabla de Excel a Word
Como exportar varias tablas de Excel a Word
Como copiar tabla vinculada de Excel a Word
Como copiar varias tablas vinculadas de Excel a Word

Antes de seguir recomiendo leer un excelente libro sobre Excel que te ayudará operar las planillas u hojas de cálculo, haz click acá, si quieres aprender sobre Excel, en inglés, entonces debes hacer click here. Si lo que necesitas es aprender o profundizar sobre la programación de macros con VBA este es unos de los mejores cursos on line que he visto en internet.

  
El ejemplo de macro que copia o exporta varias tablas vinculadas de Excel a Word, recorre los datos desde la primer hasta la última fila con datos, determinando el rango de cada tabla y copiandolas a Word en forma vinculada, es significa que al modificar la tabla en Excel se modifica en Word automáticamente una vez actualizado el vínculo.

En el vídeo que se encuentra debajo podrás ver en forma gráfica el funcionamiento de la macro como así también una explicación más detallada del código, te recomiendo descargar el archivo comprimido y descomprimirlo en cualquier lugar de la PC con la condición que se encuentre en la misma carpeta.

El arhivo comprimido tiene dos archivos uno de Excel con la Macro y otro de Word con la plantilla con el informe donde se exportarán las tablas; luego la macro creará otro archivo con un informe con tablas vinculadas; suscribe a nuestro canal de You Tube, para recibir futuros ejemplos en forma gratuita en tu correo; para suscribir al blog puedes hacerlo de la parte superior derecha de la página, solo debes agregar tu correo electrónico y listo.

Suscribe a nuestro canal de You Tube para recibir en tu correo vídeos explicativos sobre macros interesantes, como  por ejemplo formulario que crea un listado de todas las hojas para poder luego seleccionarlasbuscar en listbox mientras escribes en textboxordenar hojas libro excel por su nombreconectar Excel con Access y muchos ejemplos más.

function onYtEvent(payload) {
if (payload.eventType == ‘subscribe’) {
// Add code to handle subscribe event.
} else if (payload.eventType == ‘unsubscribe’) {
// Add code to handle unsubscribe event.
}
if (window.console) { // for debugging only
window.console.log(‘YT event: ‘, payload);
}
}


Código que se inserta en un módulo
Sub ExportaTablasWord()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim objWord As Word.Application, wdDoc As Word.Document
On Error Resume Next
Set a = Sheets(ActiveSheet.Name)
nom = ActiveWorkbook.Name
pto = InStr(nom, «.»)
nomarch = Left(nom, pto – 1)
ruta = ThisWorkbook.Path & «» & nomarch & «.docx»
Set objWord = CreateObject(«Word.Application»)
objWord.DisplayAlerts = wdAlertsNone
objWord.Visible = True
Set wdDoc = objWord.Documents.Open(ruta)
nomfic = nomarch & » » & Format(Date, «dd-mm-yyyy»)
rutainf = ThisWorkbook.Path & «» & nomfic & «.docx»

pf = 1
uff = a.Range(«A» & Rows.Count).End(xlUp).Row
n = 1

Do
uf = a.Range(«A» & pf).End(xlDown).Row
pc = a.Range(«A» & pf).Address
pwc = Mid(pc, InStr(pc, «$») + 1, InStr(2, pc, «$») – 2)

uf = uf
uc = a.Range(«A» & pf).End(xlToRight).Address
wc = Mid(uc, InStr(uc, «$») + 1, InStr(2, uc, «$») – 2)

a.Range(pwc & pf & «:» & wc & uf).Copy

ts = «[Campo_Tabla» & n & «]»
objWord.Selection.Move 6, -1
objWord.Selection.Find.Execute FindText:=ts
While objWord.Selection.Find.Found = True
objWord.Selection.PasteExcelTable True, True, False
objWord.Selection.Move 6, -1
objWord.Selection.Find.Execute FindText:=ts
Wend

pf = uf + 3
n = n + 1
Loop While pf <= uff

wdDoc.SaveAs Filename:=rutainf, FileFormat:=wdFormatXMLDocument
‘wdDoc.Close
MsgBox («Las » & n – 1 & » tablas se exportaron con éxito»), vbInformation, «AVISO»
‘wdDoc.Quit
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

Si te fue de utilidad puedes INVITARME UN CAFÉ y de esta manera ayudar a seguir manteniendo la página, CLICK para descargar en ejemplo en forma gratuita.


(adsbygoogle = window.adsbygoogle || []).push({});

If this post was helpful INVITE ME A COFFEE and so help keep up the page, CLICK to download free example.

Si te gustó por favor compártelo con tus amigos
If you liked please share it with your friends      

Entradas relacionadas

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Comentarios (63)

I am the business owner of JustCBD label (justcbdstore.com) and I’m presently aiming to develop my wholesale side of business. I really hope that someone at targetdomain share some guidance 🙂 I considered that the most suitable way to do this would be to reach out to vape shops and cbd retail stores. I was really hoping if anyone could suggest a dependable site where I can get CBD Shops B2B Companies I am already reviewing creativebeartech.com, theeliquidboutique.co.uk and wowitloveithaveit.com. On the fence which one would be the very best selection and would appreciate any guidance on this. Or would it be simpler for me to scrape my own leads? Suggestions?

Responder

Way cool! Some very valid points! I appreciate you writing this post and also the rest of the website is also really good.

Responder

Everything is very open with a very clear description of the issues. It was definitely informative. Your website is extremely helpful. Thank you for sharing!

Responder

I seriously love your website.. Very nice colors & theme. Did you develop this website yourself? Please reply back as I’m looking to create my very own blog and want to find out where you got this from or just what the theme is named. Cheers!

Responder

After I originally left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and from now on each time a comment is added I receive 4 emails with the exact same comment. There has to be a way you can remove me from that service? Cheers!

Responder

This site really has all the information and facts I wanted about this subject and didn’t know who to ask.

Responder

I just want to say I am just very new to blogging and site-building and actually liked you’re web page. More than likely I’m likely to bookmark your blog . You absolutely have exceptional posts. Bless you for revealing your blog.

Responder

I simply want to tell you that I am all new to weblog and seriously enjoyed you’re web blog. Likely I’m planning to bookmark your blog post . You certainly have fabulous article content. With thanks for sharing with us your web page.

Responder

I am typically to blog writing as well as i truly value your material. The write-up has truly peaks my rate of interest. I am mosting likely to bookmark your website and maintain looking for new details.

Responder

Oh my benefits! a fantastic article guy. Thank you However I am experiencing problem with ur rss. Don?t know why Not able to sign up for it. Is there anybody getting identical rss trouble? Any person who recognizes kindly react. Thnkx

Responder

Spot on with this article, I absolutely believe this site needs much more consideration. I?ll probably be once again to review much more, many thanks for that info.

Responder

There are definitely a great deal of details like that to consider. That is a fantastic indicate raise. I supply the ideas over as general motivation but plainly there are inquiries like the one you bring up where one of the most crucial thing will be working in straightforward good faith. I don?t recognize if best techniques have arised around things like that, but I am sure that your job is clearly determined as a level playing field. Both boys and also women feel the impact of just a moment?s pleasure, for the remainder of their lives.

Responder

I’m amazed, I must say. Rarely do I come across a blog that’s both educative and engaging, and without a doubt, you’ve hit the nail on the head. The problem is something too few folks are speaking intelligently about. Now i’m very happy that I stumbled across this in my hunt for something relating to this.

Responder

Best view i have ever seen !

Responder

Love watching sunset !

Responder

Oh my benefits! a remarkable post guy. Thanks Nonetheless I am experiencing problem with ur rss. Don?t recognize why Incapable to subscribe to it. Is there any individual getting similar rss problem? Anybody that understands kindly respond. Thnkx

Responder

Love watching sunset !

Responder

Love watching sunset !

Responder

Best view i have ever seen !

Responder

Love watching sunset !

Responder

ilmaiset videot, ilmaiset pornovideot, ilmaiset porno videot, porno video, porno videot

Responder

This really answered my drawback, thank you!

Responder

cbd oil

Responder

We are building consultants. We perform roof assessments, window testing, and wall testing for quality assurance on new and existing buildings.

Responder

Your place is valueble for me. Thanks !?

Responder

netticasinot, netticasino, casino, kasinot, nettkasinot

Responder

An outstanding share, I simply provided this onto an associate that was doing a little analysis on this. As well as he as a matter of fact purchased me breakfast since I located it for him. smile. So let me rephrase that: Thnx for the reward! But yeah Thnkx for investing the moment to review this, I feel strongly concerning it as well as enjoy reading more on this topic. When possible, as you become proficiency, would certainly you mind updating your blog with even more information? It is extremely helpful for me. Huge thumb up for this blog post!

Responder

whoah this blog is excellent i love reading your articles. Keep up the great work! You know, a lot of people are hunting around for this info, you can aid them greatly.

Responder

Howdy! I could have sworn I’ve been to this site before but after checking through some of the post I realized it’s new to me. Nonetheless, I’m definitely delighted I found it and I’ll be bookmarking and checking back often!

Responder

I do consider all of the ideas you’ve presented on your post. They’re very convincing and will definitely work. Nonetheless, the posts are very brief for newbies. Could you please lengthen them a bit from subsequent time? Thank you for the post.

Responder

There is significantly a package to understand about this. I assume you made sure wonderful points in functions also.

Responder

Quality content is the crucial to invite the visitors to go to see the web site, that’s what this web site is providing.

Responder

Thank you for the sensible critique. Me & my neighbor were just preparing to do some research about this. We got a grab a book from our area library but I think I learned more clear from this post. I’m very glad to see such magnificent information being shared freely out there.

Responder

Youre so amazing! I don’t mean Ive check out anything such as this prior to. So good to locate someone with some original ideas on this subject. realy thanks for starting this up. this internet site is something that is required online, somebody with a little creativity. helpful work for bringing something new to the net!

Responder

Pretty nice post. I just stumbled upon your blog and wished to say that I’ve truly enjoyed browsing your blog posts. In any case I will be subscribing to your rss feed and I hope you write again very soon!

Responder

I have recently started a web site, the information you provide on this website has helped me tremendously. Thank you for all of your time & work.

Responder

Thanks for a marvelous posting! I seriously enjoyed reading it, you might be a great author.I will remember to bookmark your blog and definitely will come back very soon. I want to encourage that you continue your great writing, have a nice day!

Responder

We stumbled over here by a different page and thought I may as well check things out. I like what I see so now i’m following you. Look forward to finding out about your web page for a second time.

Responder

An intriguing discussion is worth remark. I think that you should compose extra on this subject, it could not be a forbidden subject but usually people are not nearly enough to talk on such topics. To the following. Thanks

Responder

Hey there! Someone in my Myspace group shared this website with us so I came to give it a look. I’m definitely loving the information. I’m book-marking and will be tweeting this to my followers! Exceptional blog and outstanding style and design.

Responder

This is the fitting blog for anybody who wants to seek out out about this topic. You understand a lot its almost arduous to argue with you (not that I really would want…HaHa). You definitely put a brand new spin on a subject thats been written about for years. Nice stuff, just great!

Responder

custom essays https://customessayjojo.com/ – custom essays online custom essays writing custom essay meister custom essay writing reviews

Responder

There are absolutely a lot of information like that to take into consideration. That is a great indicate bring up. I offer the ideas above as basic ideas however clearly there are inquiries like the one you bring up where the most crucial thing will be operating in truthful good faith. I don?t know if ideal practices have emerged around points like that, but I am sure that your work is plainly determined as an up for grabs. Both children and girls feel the effect of simply a moment?s enjoyment, for the rest of their lives.

Responder

help with coursework https://courseworkhelpvra.com/ – do my coursework for me coursework paper online coursework coursework marking

Responder

instant essay writer https://essaywriterdodo.com/ – english essay writers п»їessay writer essay writer funny great essay writers

Responder

A lot of thanks for your own hard work on this blog. My mother delights in engaging in investigation and it is easy to see why. Most of us hear all regarding the powerful ways you produce both interesting and useful tips and tricks through the website and foster participation from others about this issue and our favorite girl is now learning a lot of things. Take pleasure in the rest of the new year. You have been doing a wonderful job.

Responder

extremely wonderful message, i definitely like this internet site, keep it

Responder

the best custom essay writing service https://essaywritingservicenews.com/ – essay writing service law best college essay service medical school essay writing service personal essay writing service

Responder

Good post. I learn something totally new and challenging on websites I stumbleupon on a daily basis. It will always be interesting to read content from other authors and practice something from their web sites.

Responder

best essay writing website https://essayonlinehdb.com/ – personal essay writers custom law essays write my essay reviews write my college essay me

Responder

tadalafil cialis http://aazmencial.com/ – tadalafil reviews discount cialis buy cheap cialis cialis

Responder

Thanks for the publish. My spouse and i have usually seen that many people are needing to lose weight simply because wish to show up slim in addition to looking attractive. Nevertheless, they do not always realize that there are more benefits to losing weight also. Doctors state that over weight people suffer from a variety of diseases that can be directly attributed to their excess weight. Thankfully that people who are overweight and suffering from diverse diseases can help to eliminate the severity of the illnesses by means of losing weight. It is possible to see a constant but identifiable improvement in health when even a small amount of weight loss is attained.

Responder

where to buy papers https://papersonlinesfy.com/ – do my paper order custom paper what should i write my paper on help writing a paper

Responder

Your place is valueble for me. Thanks !?

Responder

generic viagra 100mg http://60lmentop.com/ – viagra alternatives best price viagra mail order viagra viagra dosage

Responder

brand viagra http://45menvia.com/ – viagra order cheap viagra 100mg buy cheap purchase uk viagra buy generic viagra

Responder

college essay help nyc https://essayhelptopp.com/ – macbeth essay help need help writing a essay help writing an essay scholarship essay writing help

Responder

scholarship essay writing service https://essaywriterslop.com/ – definition essay help customer service essay essay help sites law essay writing service

Responder

Youre so trendy! I don’t intend Ive check out anything such as this before. So good to locate somebody with some original thoughts on this subject. realy thank you for starting this up. this web site is something that is needed on the internet, a person with a little originality. beneficial work for bringing something brand-new to the net!

Responder

how to write a phd thesis https://termpaperlow.com/ – help with thesis thesis online thesis in writing who to write a thesis

Responder

you’re really a good webmaster. The website loading speed is incredible. It seems that you are doing any unique trick. In addition, The contents are masterpiece. you’ve done a magnificent job on this topic!

Responder

I got what you mean , regards for posting .Woh I am glad to find this website through google. «Spare no expense to make everything as economical as possible.» by Samuel Goldwyn.

Responder

buy tadalafil http://50cialmen.com/ – cialis no prescription tadalafil reviews generic tadalafil buy cheap cialis

Responder