I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
Subject: Open a Word-Document, enter a Value of a Worksheet and save it Version: >= Excel 5
Question: How can I open a Word document with a name written in a Cell, enter a Value of a Cell in a Chart that is contained in this Document and save the Workbook as a name that is in another Cell? Answer: Enter the following Code in a Module, assign it to a Button and start it. Please note: A link to the Microsoft Word Object Library has to be created via Menu TOOLS / REFERENCES in the VB-Editor.
********** Use VBA code shown below **********
'Place the code below into the standard module Sub OpenWordDoc() Dim WordObj As Word.Application Dim WordDoc As Word.Document Dim dName$ dName = "C:\My Database\MyCopy.Doc" On Error GoTo w AppActivate "Microsoft Word" Set WordObj = Word.Application GoTo n w: Set WordObj = CreateObject("Word.Application") n: Set WordDoc = WordObj.Documents.Open(Range("A1").Value) WordDoc.Tables(1).Cell(1, 2).Range = Range("B1").Value WordDoc.SaveAs Range("C1").Value WordObj.Quit Set WordObj = Nothing Set WordDoc = Nothing End Sub
Sub OpenWordDoc() Dim objWord As Word.Application Dim docWord As Word.Document Set objWord = New Word.Application objWord.Visible = True Set docWord = objWord.Documents.Open(Filename:="C:\test.doc")
jeg havde sandelig også forventet at asol fik pointene ;-))
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.