Join Us Close. Join Tek-Tips Forums! Join Us! By joining you are opting in to receive e-mail. Promoting, selling, recruiting, coursework and thesis posting is forbidden. Students Click Here. I am using the code below within a vba module to print a pdf document. I have Adobe Reader 7 installed. Generally, the actions available from an object's shortcut menu are available verbs. The following verbs are commonly used:. Launches an editor and opens the document for editing.
If lpFile is not a document file, the function will fail. Prints the file specified by lpFile. If lpFile is not a document file, the function fails.
Launches an application as Administrator. User Account Control UAC will prompt the user for consent to run the application elevated or enter the credentials of an administrator account used to run the application. The default verb is used, if available. If not, the "open" verb is used. If neither verb is available, the system uses the first verb listed in the registry. A pointer to a null -terminated string that specifies the file or object on which to execute the specified verb.
To specify a Shell namespace object, pass the fully qualified parse name. Note that not all verbs are supported on all objects. ShellExecute returns several errors. See the documentation for comeplete error list.
Posted Feb am Yusuf. I just wanted to up-vote by 5. The advice is correct and actually conducted important message to OP.
Add your solution here. OK Paste as. Treat my content as plain text, not as HTML. Existing Members Sign in to your account. This email is in use. Do you need your password? Submit your solution! When answering a question please: Read the question carefully. I'm curious why you're adding vbNullString to the filename. Any reason for that? Any change if you don't use it? I think, adding 'vbNullString' to the end of your strings is not necessary. However, if I am wrong, you would need to add it to the "Open", as well.
It's not really needed. Just added it some day and now it's still there. Then I added it because of the documentation saying the function is taking null-terminated strings. I removed them, it makes the code more readable. Is "filename" a fully qualified path? What is in "params" and why are you passing it at all? But I agree that the return value should prove meaningful here. Add a comment. Active Oldest Votes. Improve this answer. Thomas Freudenberg Thomas Freudenberg 5, 1 1 gold badge 37 37 silver badges 43 43 bronze badges.
That's the weird thing, though. Very strange. There are at least two ways windows uses to decide which app to call for which file extension: Those that are valid for all users on the machine, and those that are user specific.
Maybe the user fiddled with the pdf file associations Explorer: Folder options - File Types. Unfortunately I don't have the return value and can get it only after deploying a new version to clients machine. But at least I could suggest reinstalling Adobe Reader.
Community Bot 1 1 1 silver badge. MarkJ MarkJ Anders Anders This seems lke an odd thing to do. If a user has changed the default verb to "Edit" or "Print" the result won't be what was desired: viewing the PDF document.
That is their choice. Its better than using a verb that might not exist. If you want the best of both worlds, you could check if the open verb exists first, and if it does not, use NULL But this way you are really screwing your user since they set a default and you ignored it — Anders.
Also, the question starts with "Which reasons" and this is a valid reason so I don't understand why you are voting me down. I have seen this problem in the wild — Anders.
0コメント