Skip to main content

Conas tuairimí a easpórtáil ó Excel go Word?

Maidir le húsáideoirí Excel, is tasc coiteann é tuairimí a chur isteach sna cealla, uaireanta, ní mór duit na tráchtanna seo a chóipeáil agus a ghreamú de dhoiciméad Word chun críche éigin. Ar ndóigh, is féidir leat an trácht a chóipeáil agus a ghreamú don Fhocal ceann ar cheann, ach is post slachtmhar agus am-íditheach é seo. An bhfuil aon bhealach ann na tráchtanna go léir a easpórtáil ó Excel go Word ag an am céanna?

Easpórtáil tuairimí ón mbileog oibre reatha go Word le cód VBA


mboilgeog cheart gorm saigheadEaspórtáil tuairimí ón mbileog oibre reatha go Word le cód VBA

Ar an drochuair, ní sholáthraíonn Excel an ghné chun na tráchtanna go léir a chóipeáil agus a ghreamú ag Word ag an am céanna. Mar sin féin, leis an gcód VBA seo a leanas, is féidir leat gach trácht ar bhileog oibre gníomhach a easpórtáil go tapa chuig an doiciméad Word.

1. Coinnigh síos an ALT + F11 eochracha a oscailt Fuinneog Microsoft Visual Basic for Applications.

2. Cliceáil Ionsáigh > Modúil, agus greamaigh an cód seo a leanas sa Fuinneog an Mhodúil.

Cód VBA: Easpórtáil tráchtanna ón mbileog oibre reatha go Word

Sub CopyCommentsToWord()
'Update 20140325
Dim xComment As Comment
Dim wApp As Object
On Error Resume Next
Set wApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
  Err.Clear
  Set wApp = CreateObject("Word.Application")
End If
wApp.Visible = True
wApp.Documents.Add DocumentType:=0
For Each xComment In Application.ActiveSheet.Comments
    wApp.Selection.TypeText xComment.Parent.Address & vbTab & xComment.Text
    wApp.Selection.TypeParagraph
Next
Set wApp = Nothing
End Sub

3. Ansin brúigh F5 eochair chun an cód seo a rith, agus rinneadh na tráchtanna go léir sa bhileog oibre gníomhach a onnmhairiú chuig doiciméad Word nua le seoladh itscell. Féach an pictiúr:

doc-onnmhairiú-tráchtanna1


Earraí gaolmhara:

Conas trácht a chur isteach go tapa ar ilchealla in Excel?

Conas cruth an bhosca tráchtaireachta a athrú in Excel?

Conas gach formáid tráchtaireachta i gcealla in Excel a athrú?

Conas ainm údair gach trácht a athrú in Excel?

Uirlisí Táirgiúlachta Oifige is Fearr

🤖 Kutools AI Aide: anailís sonraí a réabhlóidiú bunaithe ar: Forghníomhú Chliste   |  Gin Cód  |  Cruthaigh Foirmlí Saincheaptha  |  Anailís a dhéanamh ar Sonraí agus Cairteacha a Ghin  |  Feidhmeanna Kutools a agairt...
Gnéithe Coitianta: Faigh, Aibhsigh nó Aithnigh Dúblaigh   |  Scrios Sraitheanna Bána   |  Comhcheangail Colúin nó Cealla gan Sonraí a Chailleadh   |   Babhta gan Foirmle ...
Cuardaigh Super: Ilchritéir VLookup    VLookup Illuachanna  |   VLookup Trasna Ilbhileoga   |   Amharc doiléir ....
Liosta anuas Casta: Go tapa Cruthaigh Liosta Anuas   |  Liosta anuas Cleithiúnach   |  Liosta Buail Isteach Ilroghnacha ....
Bainisteoir Colún: Cuir Líon Sonrach Colún leis  |  Colúin Bog  |  Scoránaigh Stádas Infheictheachta na gColún Ceilte  |  Déan comparáid idir Raonta & Colúin ...
Gnéithe Réadmhaoin: Fócas Eangaí   |  Amharc Dearaidh   |   Barra Mór na Foirmle    Leabhar Oibre & Bainisteoir Bileog   |  Leabharlann Acmhainní (Uaththéacs)   |  Piocálaí Dáta   |  Comhcheangail Bileoga Oibre   |  Criptigh/Díchriptigh Cealla    Seol Ríomhphost trí Liosta   |  Scagaire Super   |   Scagaire Speisialta (scagaire trom/iodálach/stailc tríd...) ...
Barr 15 Uirlisí12 Téacs uirlisí (Cuir Téacs, Bain Carachtair,...)   |   50 + Cairt cineálacha (Cairt Gantt,...)   |   40+ Praiticiúil Foirmlí (Ríomh aois bunaithe ar lá breithe,...)   |   19 Insertion uirlisí (Cuir isteach Cód QR, Ionsáigh Pictiúr ón gCosán,...)   |   12 Tiontú uirlisí (Uimhreacha le Focail, Comhshó Airgeadra,...)   |   7 Cumaisc & Scoilt uirlisí (Sraitheanna Comhcheangail Casta, Cealla Scoilt,...)   |   ... agus eile

Supercharge Do Scileanna Excel le Kutools le haghaidh Excel, agus Éifeachtúlacht Taithí Cosúil Ná Roimhe. Kutools le haghaidh Excel Tairiscintí Níos mó ná 300 Ardghnéithe chun Táirgiúlacht a Treisiú agus Sábháil Am.  Cliceáil anseo chun an ghné is mó a theastaíonn uait a fháil ...

Tuairisc


Tugann Tab Oifige comhéadan Tabbed chuig Office, agus Déan Do Obair i bhfad Níos Éasca

  • Cumasaigh eagarthóireacht agus léamh tabbed i Word, Excel, PowerPoint, Foilsitheoir, Rochtain, Visio agus Tionscadal.
  • Oscail agus cruthaigh cáipéisí iolracha i gcluaisíní nua den fhuinneog chéanna, seachas i bhfuinneoga nua.
  • Méadaíonn do tháirgiúlacht 50%, agus laghdaíonn sé na céadta cad a tharlaíonn nuair luch duit gach lá!
Comments (17)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
This is excellent! however i am struggling to pin the comments to where it belong in the  worksheet. is there any way to be able to label the rows or column or cell in which the comments is extracted?
This comment was minimized by the moderator on the site
Able To Extract starts with the initial measurable data set and generates derived values ​.Users can insert and customize their numbers to professionally index business.
Philip
patchhere.com
This comment was minimized by the moderator on the site
Hey I figured out how to fix this. Line 13 needs to read "For Each xComment In Application.ActiveSheet.CommentsThreaded". (The output isn't exactly like the screenshot, you would have to add xComment.Author or perhaps some other properties in the For loop - but changing from Comments to CommentsThreaded gets this working again.)
This comment was minimized by the moderator on the site
I copied and pasted exactly but it only generated a blank word document. Any ideas?


Sub CopyCommentsToWord()
'Update 20140325
Dim xComment As Comment
Dim wApp As Object
On Error Resume Next
Set wApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Err.Clear
Set wApp = CreateObject("Word.Application")
End If
wApp.Visible = True
wApp.Documents.Add DocumentType:=0
For Each xComment In Application.ActiveSheet.Comments
wApp.Selection.TypeText xComment.Parent.Address & vbTab & xComment.Text
wApp.Selection.TypeParagraph
Next
Set wApp = Nothing
End Sub
This comment was minimized by the moderator on the site
same issue. did you manage to solve?
This comment was minimized by the moderator on the site
Same...any thoughts?
This comment was minimized by the moderator on the site
This is super helpful! Thanks!
Is there a way to pull in the row or column header rather than the cell position (B4)?
This comment was minimized by the moderator on the site
I was able to get this result by changing the "xComment.Parent.Address" to "xComment.Parent.Value" in row 14.
This comment was minimized by the moderator on the site
omg! it was really helpful!
This comment was minimized by the moderator on the site
This is great and helps! Is there a way to get actual text within the cell to replace the cell number or to be included? I have headers and balloon instructions in the headers. I am trying to create a word procedure on filling out the rows with headers of the data (Ex.; "Name") and then the comment box tells the user the format.

Currently Shows with above macro:

A1 Username:


- Enter Name of Borrower as seen on Borrower organizational documents or other name supporting documents.


Looking for it so show the text of cell A1 which is Company Name.


Any help greatly appreciated!
This comment was minimized by the moderator on the site
Can it be done to extract from filtred rows after applying filter ? Thank you.
This comment was minimized by the moderator on the site
it really helped. tq!
This comment was minimized by the moderator on the site
does anyone know if I can do this but only copying comments from a specific row? any help will be much appreciated ive been trying to work on this for ages.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations