ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro target to MsWord (https://www.excelbanter.com/excel-worksheet-functions/78216-macro-target-msword.html)

Param

Macro target to MsWord
 
Pls correct me on this formula: something wrong on opening file.

Sub openreport()
myPWD = Application.InputBox("Password Protected! Please Enter Authorized
Password to Continue!")
If myPWD = "ems5657sifooc1" Then
Application "C:\EMS-Senior1\Individual Report Class1.doc"
Else
MsgBox "Wrong Password! Bye!"
End If
For Each w In Workbooks
w.Save
Next
Application.quit
End Sub


Daniel CHEN

Macro target to MsWord
 
Not quite sure where did you get the following statement:
Application "C:\EMS-Senior1\Individual Report Class1.doc"
-- the purpose is to open the file, right?

Try to replace it with this one and re-run your code:

Shell "WinWord C:\EMS-Senior1\Individual Report Class1.doc"

It worked in my PC!

--
Best regards,
---
Yongjun CHEN
=================================
XLDataSoft - Data Analysis Expert, Excel/VBA Specialist
- - - - www.XLDataSoft.com - - - -
Free Excel-Based Data Processing Tool is Available for Download
=================================



"Param" wrote in message
...
Pls correct me on this formula: something wrong on opening file.

Sub openreport()
myPWD = Application.InputBox("Password Protected! Please Enter Authorized
Password to Continue!")
If myPWD = "ems5657sifooc1" Then
Application "C:\EMS-Senior1\Individual Report Class1.doc"
Else
MsgBox "Wrong Password! Bye!"
End If
For Each w In Workbooks
w.Save
Next
Application.quit
End Sub





All times are GMT +1. The time now is 02:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com