-
How to use Excel VBA to run MS-word VBA command
I create a excel file as database / interface,
and It would be established a MS Word file for reporting.
The report was consists the picture files ( Insert a file ),
I use the Excel command to compress the picture automatics and rename to save the MS word file as below
but sometimes it is failed to compress or they have not asked the new file name, even no any alert to save the file,
the coding as below,
Coding :
With objDoc.CommandBars.FindControl(ID:=6382)
SendKeys "%a%e%w~{Enter}"
.Execute
End With
Dim fName, fPath
fName = InputBox("Enter the file Name : Report - ", "Save As New File Name", Format(Now(), "DD-MMM-YYYY"))
fPath = Sheets("Master").Range("B1").Value
Application.DisplayAlerts = True
objDoc.SaveAs fPath & "Report - " & fName & ".doc"
End Coding
I checked the VBA code if run in MS word as below, but how can I run the code in Excel VBA coding
Coding :
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
ActiveDocument.Save
End Coding
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules