A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Script w/relative path that sends absolute path to a folder to theclipboard?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 20th 09, 01:41 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 2
Default Script w/relative path that sends absolute path to a folder to theclipboard?

I carry around my Outlook files with me on my USB flash drive, these
include the outcmd.dat and VbaProject.OTM, etc. I was hoping to
emulate the following type of script (done up in a freeware language
called AutoIt, for those not familiar with the syntax) that gives an
example of one of the paths of Outlook that is easily sent to the
clipboard no matter what computer I am or what the user profile
directory happens to be on the host computer:



ClipPut(@UserProfileDir & "\Application Data\Microsoft\Stationery")



[@UserProfileDir is a poweful tool to use in this language since you
get results with it no matter what.]


I was wondering what the above could be translated into vb so that I
can create other scripts based on that translation, using it as an
example ... ? Can this even be done in vb?

I have these types of AutoIt scripts outside of Outlook and other
office programs and use them all the time but would actually prefer to
have the 3 or so that I use strictly for Outlook saved within the
Outlook OTM scripts file itself and attached to buttons on the
interface. It just would make everything a couple of steps easier
since I would then have immediate access to the information as it'd be
a button click away right there.

Thanks!
Ads
  #2  
Old March 20th 09, 01:51 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 2
Default Script w/relative path that sends absolute path to a folder tothe clipboard?

Actually, I just realized that the above could be made even more
efficient if instead of going to the clipboard, the folder itself was
opened. D'uh, that would save even more time since all I'd do with
the clipboard information anyway is to plug it into the address bar of
windows explorer. I keep thinking that vb capabilities in Outlook
don't include windows general scripting needs but that could be way
off.

In AutoIt, to open up a folder with a relative path, this is the
syntax, in an effort to illustrate the type of scripting in vb that
would be ideal to achieve:



ShellExecute(@UserProfileDir & "\Application Data\Microsoft
\Stationery", "", "", "open", @SW_MAXIMIZE)



Sorry, hope I didn't confuse the issue but it only occurred to me
several minutes after posting the initial message in this thread.
Both types of syntax would be great, clipboard and opening a folder;
it's just that the end result is to open an Outlook folder from within
Outlook off of a button with a vb script attached that doesn't have an
absolute path. That's all I have at present but have found all these
years of using this system that it's a pain to have to keep modifying
the paths every new place I go to! Half the time I forget and it's a
pain in the ... g

Anyway, thanks. Crossing my fingers that this can be done then I need
ever again have to update those paths!!! Wow, that would be really
neat.

Cheers! D
  #4  
Old March 24th 09, 01:32 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Script w/relative path that sends absolute path to a folder to the clipboard?

Nothing to do with Outlook code.

Using Win32 API calls code would look like this:

Public Declare Function SHGetFolderPath Lib "shfolder.dll" _
Alias "SHGetFolderPathA" (ByVal hwndOwner As Long, ByVal nFolder As Long,
_
ByVal hToken As Long, ByVal dwReserved As Long, ByVal lpszPath As String)
As Long

retVal = SHGetFolderPath(0&, CSIDL_LOCAL_APPDATA Or CSIDL_FLAG_CREATE, _
0&, SHGFP_TYPE_CURRENT, strLocalSettings)

But you can't use Win32 API calls from VBScript code.

Using VBS there isn't a way that I know of to get to appData directly.
What you can do is to use the registry functions in Windows Scripting to
read a registry location that should point to appData.

The location to look at is
HKCU\Software\Microsoft\Windows\CurrentVersion\Exp lorer\Shell
Folders\AppData. That has a string value pointing to appData, you can take
that and append "\Microsoft\Stationery" to it.

The Windows scripting method to use would be WshShell.RegRead, something
like this:

Dim WshShell
Dim appDataPath
Dim strPath

strPath = _
"HKCU\Software\Microsoft\Windows\CurrentVersion\Ex plorer\Shell
Folders\AppData"

Set WshShell = CreateObject("WScript.Shell")

appDataPath = WshShell.RegRead(strPath)
appDataPath = appDataPath & "\Microsoft\Stationery"

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"StargateFan" wrote in message
...
On Fri, 20 Mar 2009 06:51:08 -0700 (PDT),
wrote:

[snip]

In AutoIt, to open up a folder with a relative path, this is the
syntax, in an effort to illustrate the type of scripting in vb that
would be ideal to achieve:



ShellExecute(@UserProfileDir & "\Application Data\Microsoft
\Stationery", "", "", "open", @SW_MAXIMIZE)


[snip]

Can something like this be done in Outlook, pls?


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
change the cache mode path (.ost file path) bln-ami Outlook - Installation 0 July 18th 06 08:45 AM
MailItem Folder Path Fox via OfficeKB.com Outlook and VBA 1 July 7th 06 02:39 PM
Getting an Outlook folder using a path Paddy Outlook and VBA 2 May 25th 06 09:32 PM
Getting a folder give a path Paddy Outlook and VBA 4 May 25th 06 08:53 PM
absolute as opposed to relative links auto-insterted in emails JR Outlook - General Queries 2 May 23rd 06 06:27 AM


All times are GMT +1. The time now is 03:40 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.