Excel VBA Introduction Part 27.1 - Creating Word Documents

Поділитися
Вставка
  • Опубліковано 29 лип 2024
  • If you'd like to help fund Wise Owl's conversion of tea and biscuits into quality training videos you can click this link www.wiseowl.co.uk/donate?t=1 to make a donation. Thanks for watching!
    You can buy our Introduction to Excel VBA book here www.lulu.com/shop/andrew-goul...
    By Andrew Gould
    www.wiseowl.co.uk - Writing VBA code in Excel doesn't only allow you to control Excel, you also have access to all of the other Office applications. This video looks at how to control Microsoft Word by writing code in Excel. You'll learn how to reference the Word Object Library, several methods for creating a new instance of the Word application, how to create new documents and how to copy data from Excel into Word. You'll also learn the importance of testing for which version of Word your users are running and how to write version-independent code that will work with (almost) any version of Word.
    Visit www.wiseowl.co.uk for more online training resources in Microsoft Excel, Microsoft Access, Microsoft PowerPoint, Microsoft Word, Microsoft Project, Microsoft Publisher, Microsoft Visio, SQL Server, Reporting Services, Analysis Services, Visual Studio, ASP.NET, VB.NET, C# and more!

КОМЕНТАРІ • 231

  • @ShineWarrior
    @ShineWarrior 2 роки тому +6

    Man, I have no words, your video is the best guide of VBA I've ever seen, you're a great teacher! Thank you so much

  • @itsdaj
    @itsdaj Рік тому +5

    I would give this 5 likes if I could. Not only is this great material, but it is also worth studying. There are so many tips and answers here. Your level of explanation is perfect.

  • @DavidAYork
    @DavidAYork 6 років тому +1

    Thank you for all the videos you've produced. They have taken me a long way from "novice" to producing outstanding content in a very short period of time.
    I like the speed you go at (I can always step back if I need to) because the amount of information is incredible. I LEARN from your videos.
    Thank you!

  • @jam92es
    @jam92es 6 років тому +13

    This is absolutely brilliant! Thank you so much for the video, you walked through everything so well and covered so many great scenarios. Thank you!

  • @tajsay
    @tajsay 4 роки тому +1

    You are simply brilliant Andrew. I haven't left with any words to thank you. I am just addicted to your videos.

  • @CyrusPieris
    @CyrusPieris 4 роки тому +2

    You are just amazing. I am actually learning computer programming via all the courses you are presenting. I will be making a donation as you are really helping me out in my career! thank you so much Andrew. Also the book you have written is amazing. I think it is the go to guide for VBA.

  • @maurocastagnera8949
    @maurocastagnera8949 6 років тому

    Dear Andrew, it's a pleasure to watch your videos! You have the great ability to be essential, but at the same time do not overlook any detail you need to understand exactly how the program works. Really at any time of the day I watch your lessons, even after a hard day's work. I really believe that you are a very intelligent person and also admirable for having made available to all your innate professional and teaching skills.
    Thank you not just for the VBA, as at the same time I'm also improving my English.
    I do not know if and when I can visit England, but I would be extremely pleased to congratulate you on getting to know you personally. Who knows ... maybe one day we will meet.
    Thank you very much.

  • @jmathew6988
    @jmathew6988 3 роки тому +1

    This tutorial stands out among all other UA-cam videos discussing the topic Excel VBA - Word. Thanks Andrew.

  • @nurlankalybekov7336
    @nurlankalybekov7336 8 років тому +3

    Hardworking in commenting and Simple.
    My raise hand.
    Thank you

  • @oz7075
    @oz7075 7 років тому +4

    What a great video, just as the rest of them on your channel. I'd like to thank you for sharing your knowledge and give thorough explanations which is what I usually look for, not simply being given the right instructions to use. One of the things I struggled most with was the use of the CreateObject or Set...New. I saw them used many times but I couldn't tell the difference. Now it's pretty clear what they're for and the advantages and disadvantages of using one option or the other. Superb work :)

  • @watcherRA
    @watcherRA 8 років тому +1

    Another smashing hit!
    Your videos are top quality, your explanations are clear, your examples are focused, and your coverage of the issues is comprehensive.
    Your UA-cam channel is a treasure trove, nothing less.
    Thank you for doing this!

    • @samouhi
      @samouhi 6 років тому

      I second watcherRA. Thank you so much for the effort you put into these tutorials and being so generous with your tips and details.

  • @ledfootdude
    @ledfootdude 8 років тому

    AMAZING, just came across your video and I have to say I don't think anyone could have done a better job. It's amazing how much depth you provide, along with making it simple to understand. LOVE IT!!! Thank you

  • @totalzack5000
    @totalzack5000 7 років тому +1

    Hi, I want to thank you for all of your great videos on vba. I've got a lot of help over the last years from you and, I LOVE the way you say "reference". Please throw more references in there and keep up the good work

  • @isabellal.1727
    @isabellal.1727 6 років тому

    Extremely detailed and easy to understand, this video is more helpful than the VBA courses I've had before, thank you so much.

  • @MrDontuknowme
    @MrDontuknowme 5 років тому +5

    This is a beautifully made tutorial. You are amazingly knowledgeable and are fantastic at conveying that knowledge. Thank YOU!

    • @WiseOwlTutorials
      @WiseOwlTutorials  4 роки тому +1

      Thank you! Happy to hear that you enjoyed the video and thank you for taking the time to leave such a nice comment!

  • @DineshKumar-lq2ck
    @DineshKumar-lq2ck 3 роки тому +1

    You are making life easier for many like me. You will definitely be blessed.

  • @renayi2842
    @renayi2842 5 років тому +1

    Absolutely wonderful! Simple, informative, easy to follow. Thank you!!

  • @88Nateg
    @88Nateg 9 років тому +1

    Brilliant tutorial thanks! I keep referring back to this vid and it's always a huge help!

  • @chrisgray8774
    @chrisgray8774 Рік тому +1

    Even my Word 2016 is outdated by now, but your techniques still apply. Thank you for your help.

    • @WiseOwlTutorials
      @WiseOwlTutorials  11 місяців тому

      Thanks Chris, happy to hear you found it useful!

  • @divyal5852
    @divyal5852 8 років тому +2

    Hi Andrew, thank you so much! Amazing video seen so far!

  • @Joni67sinix
    @Joni67sinix 6 років тому +1

    best tutorial i ever seen in my life. congrats bro!!!!

  • @kapibara2440
    @kapibara2440 Рік тому +1

    This is a brilliant video! Thank you Wise Owl ❤

  • @augustodemelo915
    @augustodemelo915 4 роки тому

    Excellent video. Great didactic technic. Congratulations!
    I cannot understand how someone can give a thumbs down for this excellent tutorial.
    For sure these people have a problem, I am sorry!
    Go ahead and bring us great things like this.

  • @musimuvi1916
    @musimuvi1916 7 років тому

    Excellent video. I normally don't "like" any videos on youtube but I HAD to like, comment and subscribe to this one. You mastery of VBA is great, you presentation skills are on point and the content is super relevant.
    Well done!

  • @mytedico
    @mytedico 2 роки тому +1

    Sir, From the start, to end this video is really worthful to watch, thank you for such an excellent video.

  • @Piplodocus
    @Piplodocus 6 років тому

    I needed to know what was in the title of the video. The last few days and in future though I've needed to know all the tons of other useful stuff in here too! Great vid. :)

  • @pyerenee1
    @pyerenee1 Рік тому +1

    Thank you so much! Exactly what I was looking for. Moreover, the entire series of videos is very interesting and useful. Also, you are a very good teacher. Thanks again!

    • @WiseOwlTutorials
      @WiseOwlTutorials  Рік тому

      Happy to hear that you found it useful, thanks for watching!

  • @yacinelimane2011
    @yacinelimane2011 2 роки тому +1

    Exactly what I was looking for, you are amazing, and a great teacher as well, God bless you.

    • @WiseOwlTutorials
      @WiseOwlTutorials  2 роки тому

      Thank you so much, I'm glad that you found the video useful!

  • @ankurverma3638
    @ankurverma3638 Рік тому

    so patient and the explanation to everything is meaningful and explains the how and why

    • @WiseOwlTutorials
      @WiseOwlTutorials  Рік тому

      Happy to hear that you found it useful! Thanks for watching and for leaving a comment!

  • @fekrabusinesssolutions
    @fekrabusinesssolutions 2 роки тому +1

    Thank you sir, this is very helpful.
    Even after getting my answers, I wanted to continue watching because it is a valuable content.

    • @WiseOwlTutorials
      @WiseOwlTutorials  2 роки тому +1

      Happy to hear that you enjoyed it, thanks for watching!

  • @MrRusseltjj
    @MrRusseltjj 9 років тому +2

    Thank you so much, my code works perfectly now!

  • @arkadyvoloshin6413
    @arkadyvoloshin6413 4 роки тому +5

    Great tutorial, best I was able to find.

  • @dadz1299
    @dadz1299 8 років тому

    Dear Andrew, THANKS A LOT !!! Your video are very useful.

  • @maurocastagnera8949
    @maurocastagnera8949 5 років тому

    You are a genius! No other words are needed!

  • @vijaykumar-gv1dg
    @vijaykumar-gv1dg 4 роки тому

    You are simply amazing.....thank you very much for the videos. Very helpful for a beginner like me.

  • @renebehr5785
    @renebehr5785 9 років тому

    Hi Andrew, thanks for the video.

  • @marcip1456
    @marcip1456 7 років тому

    I don't understand how you get any bad ratings on these videos. They are so amazing. Thanks again!

  • @peterhontaru5537
    @peterhontaru5537 6 років тому

    Fantastic lesson - thank you very much!!!

  • @VictorKap
    @VictorKap Рік тому +1

    Brilliant, love your work. Thank you

  • @ec_789
    @ec_789 9 років тому

    Thank you very much for your awesome videos

  • @sachinkathpalia
    @sachinkathpalia 7 років тому

    thank you for very detailed and informative tutorial.

  • @ankurverma3638
    @ankurverma3638 Рік тому

    you are the greatest VBA teacher

  • @PFCMCS
    @PFCMCS 7 років тому

    Excellent video, very clear explainations

  • @Trucpq
    @Trucpq 26 днів тому +1

    So helpful and excelent explanation !

    • @WiseOwlTutorials
      @WiseOwlTutorials  17 днів тому

      Thanks! Glad you found it useful, thank you for watching!

  • @AspullSpasandPools
    @AspullSpasandPools 9 років тому

    Thank you very much the best tutorial i have see on the net

  • @abdullahquhtani4247
    @abdullahquhtani4247 6 років тому

    One more question plz, what if I want to save the document as PDF instead of .doc or .docx?
    Thank you.

  • @KM-co5mx
    @KM-co5mx 2 роки тому +1

    This is Awesome! and You're Awesome! 🙇‍♂

  • @watawonderfulworld
    @watawonderfulworld 6 років тому

    just toooooo good... thanks a lot for sharing

  • @makifguzey
    @makifguzey 8 років тому

    Thanks a lot, great video.

  • @healerca
    @healerca 7 років тому

    Great video. Thank-you very much

  • @parikshitpadture4122
    @parikshitpadture4122 5 років тому +1

    Thanks Andrew for the useful video

    • @WiseOwlTutorials
      @WiseOwlTutorials  5 років тому

      You're welcome, Parikshit, thank you for watching!

  • @adriancelis9691
    @adriancelis9691 5 років тому +1

    Great explanation. Thanks!

  • @Chris_in_fremantle
    @Chris_in_fremantle 7 років тому

    Excellent tutorial.

  • @engenheiromalucoo.o2576
    @engenheiromalucoo.o2576 5 років тому

    This guy is the best!

  • @user-iv8en3rv7m
    @user-iv8en3rv7m 8 місяців тому +1

    Great work! Thank you for this greate tutorial!

  • @scotolivera8207
    @scotolivera8207 4 роки тому +3

    thank you, sir for this well-designed tutorial, What about MS access, are you planning for making a tutorial for it too?

  • @julianevans2256
    @julianevans2256 Рік тому +1

    Awesome tutorial, I've known about early and late binding for years without really understanding it? this has explained it really well

  • @patricknyamu6110
    @patricknyamu6110 10 років тому

    Wonderful!!! thanks

  • @cristoumanzor3896
    @cristoumanzor3896 4 роки тому

    Great lecture!

  • @Princessels1331
    @Princessels1331 6 років тому

    Thank you... very interesting.

  • @chathurathilakarathne2205
    @chathurathilakarathne2205 4 роки тому +1

    That's bloody beautiful

  • @victoropere2107
    @victoropere2107 6 років тому

    simply amazing

  • @ssa1632
    @ssa1632 4 роки тому +1

    Thank you so much! Superb! Would u please guide me the code for making two pages in word documents for two separate ranges in Excel!

  • @KawanExcel
    @KawanExcel 2 роки тому +1

    This is so much.... Thanks Andrew

    • @WiseOwlTutorials
      @WiseOwlTutorials  2 роки тому

      You're very welcome! Glad you enjoyed this video too and thank you for watching!

  • @shaunmaher278
    @shaunmaher278 9 років тому

    Hello, thanks very much for the video.
    How can you save the Word document with a unique name, thats perhaps references a cell in the Excel Worksheet?

  • @lietus0
    @lietus0 5 років тому +1

    For someone in future, if you are looking to copy embedded chart you should use something like this in your code:
    Dim MyChart As ChartObject
    Set MyChart = ThisWorkbook.Sheets("DOC").ChartObjects("Chart 1")
    MyChart.Chart.ChartArea.Copy
    .Selection.GoTo what:=-1, Name:="ChartLocation"
    .Selection.Paste

    • @WiseOwlTutorials
      @WiseOwlTutorials  5 років тому

      Hi Matiss, thanks for this, we do cover referencing ChartObjects in a separate video ua-cam.com/video/buRwtzVw7UQ/v-deo.html but it's always useful to have tips like this around to help remind people. Thanks for taking the time to add it and for watching!

  • @ricardobrizuela7589
    @ricardobrizuela7589 7 років тому

    awesome video!

  • @Rebel36X
    @Rebel36X 6 років тому

    Excellent Video! Just wondering if I can SaveAs my document using data from a cell in my document title?

  • @thinkandchangethewayyouthi9142
    @thinkandchangethewayyouthi9142 5 років тому +1

    Thanks ,
    Perfect way of exlpanation

  • @glennlaanekorb9168
    @glennlaanekorb9168 4 роки тому

    Well explained video and was super easy to follow. How would you take cells out of the excel table and insert into word document in a custom table that is created with VBA code?

  • @dksuthar31
    @dksuthar31 Рік тому +1

    thank you wise owl

  • @jopinfuyiro5570
    @jopinfuyiro5570 2 роки тому +1

    дядька просто лучший

  • @ondrakvratislav
    @ondrakvratislav 7 років тому +1

    Amazing techniques of the tutor. Very well prepared

  • @fabianreurekas9996
    @fabianreurekas9996 3 роки тому +1

    Thank you very much!

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 роки тому

      You're very welcome Fabian, thank you for watching!

  • @mickcarroll1
    @mickcarroll1 9 років тому +1

    Hi Andrew, yours are the best delivered tutorials on UA-cam bar none. I'm less than a newbie in VBA and may have missed this but is there a way of personalising each email - e.g. "Hi ,"? while still adding attachments?

  • @91alezander
    @91alezander 4 роки тому

    It is possible to generate a word template from every excel row individually. In excel I need a button to appear on every new row I populate with data and the button must open the word template that was fill with the data that I populate the row. And also i need the autofill word template to be save in a specified location. Thank you!

  • @kristiandadhley977
    @kristiandadhley977 7 років тому

    Great Vid! Would a similar thing be done if you wanted to populate a word report with data from excel. i.e. you had a standard MS word report that said something like.
    "Since the last report X people have signed up with the company and Y people have retired" where you want to populate the X and Y with values from an excel sheet?

  • @martinvarela206
    @martinvarela206 8 років тому

    Hi!, there are any chances that you make a tutorial or at least offer a link about manipulate style list from excel vba, with data (like items, if they use number or dots, the level of the item) on a table, for give format in word?

  • @jordanjvansickle
    @jordanjvansickle 7 років тому

    This is great! How can I get my data to automatically scale to fit the word document? The data in Excel fits within the page guidelines, but it does not when I transfer it to Word.

  • @CallipygianMoose
    @CallipygianMoose 4 роки тому

    great video and it works perfectly so thanks! I would like to add something else to this but I'm not sure how....> my table that I am importing to word has some cells that contain formulas that are returning null-strings. Unfortunately when the table is imported to word it imports the blank rows. I could of course just delete them after they have been imported, however I thought Id ask if there was a way using VBA code when selecting the columns to be sent to word, to ignore all cells containing null-strings? currently i could have values on row a, nothing on row b, values on row c etc in any order. I only want VBA to take data from the table of values that contains a value, and I do not want gaps between. I dont necesarily want to remove the formula or the null-string from the Excel document its self, I just want it to ignore those cells when exporting and sort it in such a way that there are no gaps where nullstrings would have been.

  • @chriscook4076
    @chriscook4076 9 років тому

    Hello Andrew. Thanks for the great video tutorial! I was hoping that you might post a video (or perhaps reply with the code) to copy only specific cells from excel to the bookmarks in word. In my job I put together contracts that have repetitive information and I wanted to put together a one page "Questionnaire" (for lack of a better term) to inject the "answers" into whichever page of the word doc it relates to using the bookmark method. Any help or suggestions is greatly appreciated!

  • @retrofutur1st
    @retrofutur1st 3 роки тому +1

    Thank you!!!!

  • @droidgenetx
    @droidgenetx 5 років тому

    thank you!

  • @jujutheplayer
    @jujutheplayer 9 років тому

    That helped me a lot thanks :-) !

    • @jujutheplayer
      @jujutheplayer 9 років тому

      ***** I ran into trouble recently, I'm trying to insert a word table to a bookmark location but sadly I can't get it working :-( I'd be very thankful if you could help me :-)

  • @cullenharris1837
    @cullenharris1837 3 роки тому

    Is anyone else getting an error in the SaveAs2 line at the 29:30 mark? It says to check the path or select a file from the list.... any advice is greatly appreciated!

  • @joncroweucl
    @joncroweucl 7 років тому

    Thank you for the excellent video.
    I can paste data into bookmarks and am using .Selection.PasteSpecial DataType:=wdPasteText so the information within cells is pasted as text at the bookmark location within a paragraph. However, doing so removes the bookmark and the reference for subsequent cross-referenced text.
    How can I paste data from Excel into Bookmarks in Word and still retain the bookmark for cross-referencing?
    Thanks again :)

  • @kamalakotagiri7174
    @kamalakotagiri7174 4 роки тому

    Can we copy an image from a perticular page of word doc and paste in PPT with VBA? Please help.

  • @singhdevprashant
    @singhdevprashant 4 роки тому

    Pls suggest VBA code to copy specific selections from one Word file to another, by opening data from one file and copying it to other using VBA. Thanks a lot in advance.

  • @arvindkumarauro9731
    @arvindkumarauro9731 3 роки тому +1

    Thanks a ton sir 😘

  • @cekinci
    @cekinci 9 років тому

    Hi Andrew, first I would like to say your videos are great, and can't believe this to be free!!
    Anyways, I would like to know if I could edit a word file like a contract, and change the data within using my excel worksheet.
    For instance, I only use "find-replace" to edit manually, but I would like to automate it if possible?

  • @JS-zb6zh
    @JS-zb6zh 5 років тому

    great video. I am trying to copy a table range from word to excel. I am stuck with word vba syntax. wDoc.Tables(1).cell(2,2) to cell(3,9) can you please help me. Thanks in advance.

  • @1309poorva
    @1309poorva 7 років тому

    i learnt online and created a VBA code for excel 2016 on macbook.
    however, the syntax is probably a little different for ios.
    can someone help me with it?
    thanks

  • @divyal5852
    @divyal5852 8 років тому

    Hi Andrew, would be happy if you could solve this for me..tried googling but no much information - "how to possibly embed the word doc or the excel itself in the powerpoint presentation? ." . . . Thank you in advance

  • @colerees3965
    @colerees3965 9 років тому

    I was having some difficulties using the Format function for the date -- (compile error: Wrong number of args...). I solved by writing in: VBA.Format(arguments). There is another function in the intellisense called: format (with a lowercase f). Do you have any idea where this function comes from?

  • @RamboRoberto2905
    @RamboRoberto2905 4 роки тому

    Hello: please advise how to center a text vertically (as Page Setup/Layout/Page/Center). Also, please advise how to enter a new page in the created word document (as page break). In your video you showed how to enter a new line (with .TypeText vbnewline) or new paragraph (.Typeparagraph). Thank you.

  • @ravibabu2253
    @ravibabu2253 4 роки тому

    I could not done Mail merge with Excel XLSM FILE Plese tell me how can i do this

  • @freebeatingheart3006
    @freebeatingheart3006 9 років тому

    Thanks for this excellent tutorial.
    How can the cell heights and widths be retained when copied over to Word?

    • @freebeatingheart3006
      @freebeatingheart3006 8 років тому

      +WiseOwlTutorials Thanks. With a slight tweek I used:
      Range("A1", "I56").CopyPicture
      wdapp.Selection.Paste
      "Current region" seems to select one cell only.

  • @krloskrloncho
    @krloskrloncho 4 роки тому

    Hi. I have a question if anyone can help me out. I'm trying to locate a bookmark inside a textbox (in my Word Document), but when I run the code in excel VBA says error 5678: Word can't find the specified bookmark. Any help will be appreciated.

  • @nishchaynagpal6051
    @nishchaynagpal6051 7 років тому +1

    Hi, I had a query. If we use late binding in vba then there is no need for word,outlook,etc. library but when i did that the actions(object.action) that you use in this video gave an error as variable not defined which should not happen, as you said that people tend to program using early binding and then convert later to late binding.
    The line that gave me the error was '.ParagraphFormat.Alignment = wdAlignParagraphCenter'.

    • @nishchaynagpal6051
      @nishchaynagpal6051 7 років тому

      WiseOwlTutorials I got confused since it was not working. Thanks :)

  • @m.mohtashim2000
    @m.mohtashim2000 3 роки тому

    I really appreciate your tutorials Andrew, they helped me learn a lot.
    One thing I would advise you to do is that get the different sections inside the description box and youtube will create navigation panes for the video and that way it will be easier to navigate to specific sections of tutorials.

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 роки тому

      Thanks yes, we've been adding chapters to all of the videos we release for the past six months or so. We haven't had the time to go back to the hundreds of older videos to do the same yet!
      I'm happy to hear that you found the video useful anyway, thank you for watching and for sharing that tip!

    • @m.mohtashim2000
      @m.mohtashim2000 3 роки тому

      @@WiseOwlTutorialsOhh I see, I understand it will take quite a long time to do that for each video.
      Much Appreciated😊

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 роки тому

      @@m.mohtashim2000 Indeed it will - I wish we hadn't made so many videos now!

    • @m.mohtashim2000
      @m.mohtashim2000 3 роки тому

      @@WiseOwlTutorials Can I make a request to you. Can you please make an in-depth tutorial on word macros as well.

    • @WiseOwlTutorials
      @WiseOwlTutorials  3 роки тому

      @@m.mohtashim2000 Hi there! I don't think it's very likely that we'll have an entire series on Word macros although we will probably have the occasional video involving Word.