Skip to main content

Conas comhad sonrach Excel a oscailt ó Outlook?

Más mian leat comhad sonrach Excel a úsáid go minic agus tú ag obair ar Outlook, mar sin ní mór duit an comhad seo a oscailt anois agus arís. An bhfuil aon bhealach tapa agus éasca ann chun comhad sonraithe leabhar oibre a oscailt ó Outlook? An t-alt seo, labhróidh mé faoi conas é a réiteach.

Oscail comhad Excel ar leith ó Outlook le cód VBA


Oscail comhad Excel ar leith ó Outlook le cód VBA

Is féidir leat an cód VBA seo a leanas a úsáid chun comhad réamhshocraithe leabhar oibre a oscailt de réir mar is gá duit, déan é seo le do thoil:

1. In Outlook, coinnigh síos an ALT + F11 eochracha a oscailt Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

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

Cód VBA: Oscail comhad Excel ar leith ó Outlook:

Public Sub OpenSpecificExcelWorkbook()
    Dim xExcelFile As String
    Dim xExcelApp As Excel.Application
    Dim xWb As Excel.Workbook
    Dim xWs As Excel.Worksheet
   Dim xExcelRange As Excel.Range
    xExcelFile = "C:\Users\DT168\Desktop\split document\kto-data.xlsx"
    Set xExcelApp = CreateObject("Excel.Application")
    Set xWb = xExcelApp.Workbooks.Open(xExcelFile)
    Set xWs = xWb.Sheets(1)
    xWs.Activate
    Set xExcelRange = xWs.Range("A1")
    xExcelRange.Activate
    xExcelApp.Visible = True
End Sub

nótaí: Sa chód thuas, ba cheart duit cosán comhaid Excel a athrú: C: \ Úsáideoirí \ DT168 \ Deisce \ doiciméad roinnte \ kto-data.xlsx leat féin.

3. Agus ansin, fós sa Microsoft Visual Basic d’Fheidhmchláir fuinneog, cliceáil uirlisí > tagairtí dul go dtí an Tagairtí-Tionscadal1 bosca dialóige, agus seiceáil Leabharlann Réada Microsoft Excel rogha ón Tagairtí atá ar Fáil bosca liosta, féach an scáileán:

doc oscailte barr feabhais sonrach 1

4. Ansin, cliceáil OK cnaipe chun an dialóg a fhágáil, an fhuinneog cód a shábháil agus a dhúnadh. Anois, ba cheart duit an cód seo a chur leis an Barra Uirlisí Rochtana Tapa.

5. I bpríomh-chomhéadan an Outlook, cliceáil Saincheap Barra Uirlisí Rochtana Tapa deilbhín, agus roghnaigh Tuilleadh Orduithe, féach ar an scáileán:

doc oscailte barr feabhais sonrach 2

6. sa Roghanna Outlook bosca dialóige:

  • (1.) Roghnaigh Macraí ó na Roghnaigh orduithe ó liosta anuas;
  • (2.) Agus ansin roghnaigh an t-ainm cód VBA atá curtha isteach agat díreach anois;
  • (3.) Cliceáil Cuir cnaipe chun an cód a chur isteach sa Saincheap Barra Uirlisí Rochtana Tapa bosca liosta.

doc oscailte barr feabhais sonrach 3

7. Agus ansin taispeántar macra-íocón isteach sa Barra Uirlisí Rochtana Tapa mar a leanas an pictiúr a thaispeántar. As seo amach, nuair a chliceálann tú an cnaipe seo, osclófar do chomhad Excel sonraithe ag an am céanna.

doc oscailte barr feabhais sonrach 4


Uirlisí Táirgiúlachta Oifige is Fearr

Kutools le haghaidh Outlook - Níos mó ná 100 Gnéithe cumhachtacha chun do Outlook a shárú

🤖 Cúntóir Ríomhphoist AI: Ríomhphoist pro toirt le draíocht AI - aon-cliceáil chun freagraí genius, ton foirfe, máistreacht ilteangach. Trasfhoirmigh ríomhphost gan stró! ...

📧 Uathoibriú Ríomhphoist: As Oifig (Ar fáil do POP agus IMAP)  /  Sceideal Seol Ríomhphoist  /  Auto CC/BCC de réir Rialacha Agus Ríomhphost á Sheoladh  /  Auto Ar Aghaidh (Ardrialacha)   /  Beannacht Auto Cuir leis   /  Scoilt Ríomhphoist Ilfhaighteoirí go huathoibríoch i dTeachtaireachtaí Aonair ...

📨 Bainistíocht Ríomhphost: Ríomhphoist a Athghairm go héasca  /  Bloc Ríomhphoist Scam ag Ábhair agus Daoine Eile  /  Scrios Ríomhphoist Dúblacha  /  Cuardach Casta  /  Comhdhlúthaigh Fillteáin ...

📁 Ceangaltáin ProSábháil Baisc  /  Baisc Dícheangail  /  Comhbhrú Baisc  /  Auto Sábháil   /  Auto Dícheangail  /  Comhbhrúite Auto ...

🌟 Draíocht Chomhéadain: 😊Níos mó Emojis Pretty and Cool   /  Treisiú Do Tháirgiúlacht Outlook le Radhairc Tabbed  /  Íoslaghdaigh Outlook In ionad Deiridh ...

???? Wonders aon-cliceáil: Freagair Gach Duine le Ceangaltáin Isteach  /   Ríomhphoist Frith-Iascaireachta  /  🕘 Taispeáin Crios Ama an tSeoltóra ...

👩🏼‍🤝‍👩🏻 Teagmhálaithe & Féilire: Baisc Cuir Teagmhálacha Ó Ríomhphoist Roghnaithe  /  Roinn Grúpa Teagmhála ar Ghrúpaí Aonair  /  Bain Meabhrúcháin Breithlá ...

Thar Gnéithe 100 Fan le do Thaiscéalaíocht! Cliceáil Anseo le Tuilleadh Amach.

 

 

Comments (6)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
7行目のファイルのフルパスを修正して使っていますが、読み取り専用で開いてしまい、データを修正した後上書き保存ができませんでした。

ネットワークフォルダにあるエクセルの場合は、読み取り専用で開いてしまうのでしょうか?
Windowsのプレビューウインドウも含めて、Excelアプリケーションは一切開いていない状態でも同様に読み取り専用で開いてしまいます。
何か対処法があれば教えていただければ幸いです。

ちなみに、Outlook、Excelともに2019環境です。
This comment was minimized by the moderator on the site
Hello,
The code works well in my Outlook, and the Excel file opens normally, not open with read only mode.

You can insert your Excel file here if you don't mind, so that I can check the code.

Thank you!
This comment was minimized by the moderator on the site
Outlook rejects the code immediately with an error. "Compile Error. User defined type not defined." And it zeroes in on "Dim xExcelApp As Excel.Application" as the problem. I literally just copied and pasted it as is into the editor and tried to run it and it fails out immediately.
This comment was minimized by the moderator on the site
Did you enable the microsoft excel library first?
This comment was minimized by the moderator on the site
This works pretty well!

Could you help me with the line of code in addition to it on how to close the workbook without saving changes.
This comment was minimized by the moderator on the site
Or you can run .bat file:


.bat:
@echo off
"C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE" "D:\your_file.xlsx"

and VBA:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "D:\your_BAT.bat" & Chr(34), 0
Set WshShell = Nothing



https://www.winhelponline.com/blog/run-bat-files-invisibly-without-displaying-command-prompt/
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations