• ** There has been a recent site upgrade. Please clear your browser cache to avoid issues. **
  • New forum feature - post voting and best solution

    Check out this thread for the details: https://www.access-programmers.co.uk/forums/threads/new-forum-feature-post-voting-and-best-answer.314134/

    This new feature looks great to me! :)

  • We now have 3 forum themes

    Go for the default (light) theme, Shades of Grey or Shades of Blue. I just added the Blue one.

    The thread about it is here: https://www.access-programmers.co.uk/forums/threads/new-forum-theme-shades-of-blue.314136/

Saving Outlook Attachment (1 Viewer)

Isaac

Lifelong Learner
Local time
Today, 10:33
Joined
Mar 14, 2017
Messages
2,437
The code on that page is fairly portable to be run in any Office program that supports VBA. You could run that from Access, Word, Excel, or Outlook itself. You might need to make some tiny adjustments, depending on which host you need.

How exactly do you want to trigger it, if you also want to avoid any host program being open when it runs?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:33
Joined
Oct 29, 2018
Messages
12,532
Hi. That code doesn't even mention Access, so I am not sure why you thought Access had to be open?
 

jo15765

Registered User.
Local time
Today, 10:33
Joined
Jun 24, 2011
Messages
91
Hi. That code doesn't even mention Access, so I am not sure why you thought Access had to be open?

the code is vba, I would adapt it to run via access vba - but I know from previous experience you can't have an access macro run if the access db is not open which lead to my ?
 

jo15765

Registered User.
Local time
Today, 10:33
Joined
Jun 24, 2011
Messages
91
The code on that page is fairly portable to be run in any Office program that supports VBA. You could run that from Access, Word, Excel, or Outlook itself. You might need to make some tiny adjustments, depending on which host you need.

How exactly do you want to trigger it, if you also want to avoid any host program being open when it runs?

Yes, the code is VBA, I'd adapt it to access vba to execute. My question, you are correct is how could I trigger it w/o access being open?

Altho, that makes the mind wonder, if I could adapt that to a vbscript. hmmmm...amazing what the mind can think of with just a few simple bits of assistance
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:33
Joined
Oct 29, 2018
Messages
12,532
the code is vba, I would adapt it to run via access vba - but I know from previous experience you can't have an access macro run if the access db is not open which lead to my ?
Hi. Thanks for trying to clarify your question/intention. The sample code you referenced uses Excel VBA, so Access doesn't have to be open when you run it. However, Excel has to be open though. So, if you're planning to use Access VBA instead of Excel, then Access has to be open. If you don't want Access to be open, then you'll have to use something else than Access. Like you said, VBScript can do it. However, whichever you use, Outlook will have to be open anyway, then perhaps just use Outlook VBA, and you won't need anything else to be open.
 

Isaac

Lifelong Learner
Local time
Today, 10:33
Joined
Mar 14, 2017
Messages
2,437
Yes, the code is VBA, I'd adapt it to access vba to execute. My question, you are correct is how could I trigger it w/o access being open?

Altho, that makes the mind wonder, if I could adapt that to a vbscript. hmmmm...amazing what the mind can think of with just a few simple bits of assistance
You read my mind.
The first point I am trying to make is, while dbGuy is right of course, Ron's webpages (that one included) are targeted toward Excel, yet that code is almost 100% relevant to the Outlook object model, and can be ported to any Office program with extremely minimal adjustments, if any.

The next point I was going to make, which you have now stated, is.....it sounds like VBScript might be a solution for you. I have written many VBScripts which essentially execute against VBA object models, in cases where I don't want to cause an actual Office program to open in a typical, visible, user-interactive manner. If you are somewhat familiar with VBScript and are comfortable using its syntax along with late-binding the Office automation, that's probably your solution. Be aware that this will still mean the Office program you are referencing in your VBScript still needs to be installed on the host user's machine. But the advantage of the VBScript--which I assume is the advantage you are after--is the triggering aspect, you will gain the advantage that to trigger this code, Outlook does not need to be open and the script can be called from virtually any context you can think of, stealth mode, so to speak.

I'd probably just double check that the code you have contains no references to Excel (eliminate them if it does), and then go with VBScript & Outlook automation.
 

Users who are viewing this thread

Top Bottom