![]() |
Searching and Then Copy Cell to word
Please Help!! I am Trying to search this sheet for TxtCaseName, Then Copy Cell 42 this is what it should say i think... am i doing something wrong?it gives me the error Object Variable not set :( Private Sub CmdPrint_Click() Dim sh As Worksheet Dim WrdApp As New Word.Application Dim wrdDoc As New Word.Document sh.Columns(1).Range("A5").Find(What:=TxtCaseName, LookIn:=xlFormulas).Offset(0, 42).Copy ' Create a new Word Document Set wrdDoc = WrdApp.Documents.Add(DocumentType:=wdNewBlankDocum ent) WrdApp.Visible = True WrdApp.Selection.Paste Set wrdDoc = Nothing Set WrdApp = Nothing End Sub |
Searching and Then Copy Cell to word
from
sh.Columns(1).Range("A5").Find(What:=TxtCaseName, LookIn:=xlFormulas).Offset(0, 42).Copy to set c = sh.Columns(1).Range("A5").Find(What:=TxtCaseName, LookIn:=xlFormulas) if not c is nothing then c.Offset(0, 42).Copy end if " wrote: Please Help!! I am Trying to search this sheet for TxtCaseName, Then Copy Cell 42 this is what it should say i think... am i doing something wrong?it gives me the error Object Variable not set :( Private Sub CmdPrint_Click() Dim sh As Worksheet Dim WrdApp As New Word.Application Dim wrdDoc As New Word.Document sh.Columns(1).Range("A5").Find(What:=TxtCaseName, LookIn:=xlFormulas).Offset(0, 42).Copy ' Create a new Word Document Set wrdDoc = WrdApp.Documents.Add(DocumentType:=wdNewBlankDocum ent) WrdApp.Visible = True WrdApp.Selection.Paste Set wrdDoc = Nothing Set WrdApp = Nothing End Sub |
All times are GMT +1. The time now is 10:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com