Loncat ke daftar isi utama

Bagaimana cara membuka file Excel tertentu dari Outlook?

Jika Anda ingin sering menggunakan file Excel tertentu saat bekerja di Outlook, jadi Anda perlu membuka file ini sekarang dan nanti. Apakah ada cara cepat dan mudah bagi Anda untuk membuka file buku kerja tertentu dari Outlook? Artikel ini, saya akan berbicara tentang cara mengatasinya.

Buka file Excel tertentu dari Outlook dengan kode VBA


Buka file Excel tertentu dari Outlook dengan kode VBA

Anda dapat menggunakan kode VBA berikut untuk membuka file buku kerja default yang Anda butuhkan, lakukan seperti ini:

1. Di Outlook, tahan ALT + F11 kunci untuk membuka Microsoft Visual Basic untuk Aplikasi jendela.

2. Lalu klik Menyisipkan > Modul, dan tempel kode berikut di Modul Jendela.

Kode VBA: Buka file Excel tertentu dari 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

Note: Pada kode di atas, Anda harus mengubah jalur file Excel: C: \ Users \ DT168 \ Desktop \ split dokumen \ kto-data.xlsx untuk Anda sendiri.

3. Dan kemudian, masih di Microsoft Visual Basic untuk Aplikasi window, klik Tools > Referensi untuk pergi ke Referensi-Proyek 1 kotak dialog, dan centang Perpustakaan Objek Microsoft Excel pilihan dari Referensi yang Tersedia kotak daftar, lihat tangkapan layar:

doc terbuka spesifik excel 1

4. Lalu klik OK tombol untuk keluar dari dialog, simpan dan tutup jendela kode. Sekarang, Anda harus menambahkan kode ini ke Quick Access Toolbar.

5. Di antarmuka utama Outlook, klik Sesuaikan Bilah Alat Akses Cepat ikon, dan pilih Lebih Banyak Perintah, lihat tangkapan layar:

doc terbuka spesifik excel 2

6. Dalam majalah Pilihan Outlook kotak dialog:

  • (1.) Pilih Macro dari Pilih perintah dari daftar drop-down;
  • (2.) Dan kemudian pilih nama kode VBA yang baru saja Anda masukkan;
  • (3.) Klik Add tombol untuk menambahkan kode ke dalam Sesuaikan Bilah Alat Akses Cepat kotak daftar.

doc terbuka spesifik excel 3

7. Dan kemudian ikon makro ditampilkan ke file Quick Access Toolbar seperti gambar berikut yang ditampilkan. Mulai sekarang, saat Anda mengklik tombol ini, file Excel yang Anda tentukan akan segera dibuka.

doc terbuka spesifik excel 4


Alat Produktivitas Kantor Terbaik

Kutools untuk Outlook - Lebih dari 100 Fitur Canggih untuk Meningkatkan Outlook Anda

🤖 Asisten Surat AI: Email profesional instan dengan keajaiban AI--satu klik untuk mendapatkan balasan jenius, nada sempurna, penguasaan multibahasa. Ubah email dengan mudah! ...

📧 Email Otomatis: Di Luar Kantor (Tersedia untuk POP dan IMAP)  /  Jadwal Kirim Email  /  Auto CC/BCC Sesuai Aturan Saat Mengirim Email  /  Penerusan Otomatis (Aturan Lanjutan)   /  Tambah Salam Otomatis   /  Secara Otomatis Membagi Email Multi-Penerima menjadi Pesan Individual ...

📨 email Management: Mengingat Email dengan Mudah  /  Blokir Email Penipuan berdasarkan Subjek dan Lainnya  /  Hapus Email Duplikat  /  Pencarian  /  Konsolidasi Folder ...

📁 Lampiran ProPenyimpanan Batch  /  Pelepasan Batch  /  Kompres Batch  /  Penyimpanan otomatis   /  Lepaskan Otomatis  /  Kompres Otomatis ...

🌟 Antarmuka Ajaib: 😊Lebih Banyak Emoji Cantik dan Keren   /  Tingkatkan Produktivitas Outlook Anda dengan Tampilan Tab  /  Minimalkan Outlook Daripada Menutup ...

👍 Keajaiban sekali klik: Balas Semua dengan Lampiran Masuk  /   Email Anti-Phishing  /  🕘Tampilkan Zona Waktu Pengirim ...

👩🏼‍🤝‍👩🏻 Kontak & Kalender: Batch Tambahkan Kontak Dari Email yang Dipilih  /  Bagi Grup Kontak menjadi Grup Individual  /  Hapus Pengingat Ulang Tahun ...

Lebih 100 Fitur Tunggu Eksplorasi Anda! Klik Di Sini untuk Menemukan Lebih Banyak.

 

 

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