PDA

View Full Version : Solved: OLECMDID_SAVE or SAVEAS pvain pvaout



CodeNinja
07-26-2012, 07:30 AM
Hi Guys,
I am very close to figuring out every piece of my project at work. I have one bit of syntax I am unfamiliar with left and would love some help.

My project opens a series of pdf files via web browser (in my case tab #2 will open this pdf file, but I can control that if need be...). The part I am struggling with is saving the pdf file in a location I designate.

The method I believe I need to use is ie.OLECMDID_SAVE or SAVEAS. If I use dodefault, saveas will prompt me where to save with a dialog box. I do not want this prompt, so I can use dontpromptuser. The problem I have is as follows:

1- How do I tell the method to save in location C://Dir1/Dir2 (or whatever path I choose)?

2- How do I tell the method to save tab 2, not tab 1?

Do i use the optional variant pvain or pvaout somehow? If so what would that syntax look like?

Great thanks to those more experienced and wiser than me...

Josh / CodeNinja.

Kenneth Hobs
07-26-2012, 07:45 AM
It might easier to download it to a file? http://www.vbaexpress.com/forum/showthread.php?t=19303

CodeNinja
07-26-2012, 08:03 AM
Kenneth,
Thanks for the reply, unfortunately, the way this site navigates, I do not believe that is possible. I think I am stuck loading it then saving it.

CodeNinja
07-26-2012, 12:06 PM
Kenneth,
I stand corrected. The supplied code works for my needs. Thank you!:bow:

Interestingly, I needed to correct the private function at the top ... the lib "urlmon" should be "urlmon.dll" and I believe that is why it was causing problems for some later in the thread.

I am marking this thread solved, and if you would like I will provide the final code once I have written it as an example of web browsing to gather information then saving the document.

Thank you again for your assistance. It would have taken me forever to figure some of this stuff out without a nudge.

Kenneth Hobs
07-26-2012, 12:57 PM
Glad it helped.

Not sure why you needed the file extension. Maybe it is an operating system deal or an Explorer setting issue.

It is a good idea to post a final solution as some review threads years later.

I used that sort of method in a recent thread to get the graphic QR code into a file. http://www.vbaexpress.com/forum/showthread.php?t=43015

"Great code is not made, it is remade." - Kenneth Hobson, July 26, 2012