In Function Outlook_Tasks_2_Access I can't find "Items.Count" ?
In Function Outlook_Tasks_2_Access I can't find "Items.Count" ?
Did you add the code changes in the declaration section and Form_Load?
Quote:
Originally posted by RobDog888
binduau, what was the solution?
If you mean what was the solution to the Shell to open an outlook folder then this is the answer..
Pasted In the order of the calls
VB Code:
Private Sub mnuoutlookorder_Click() ' want to kill Outlook in my proggy first 'because when you open the passed folder 'a new instance of outlook loads and i don't want this 'if you can make it use the active version and switch to that folder ' if outlook is open --- or open outllook and then switch if outlook is not open i would be interested. so that i won't have to kill it first. 'This uses a few APIs and other functions which i will add if you want to see them. I also use it to kill other processes. TerminateEXE "OUTLOOK.EXE" Open_Out_Folder "Orders" End Sub Public Sub Open_Out_Folder(FolderToOpen As String) Dim strFileName As String, wShell As Object, StrAppName As String Screen.MousePointer = vbHourglass 'get the path to outlook from the registry StrAppName = GetRegStringValue$(HKEY_LOCAL_MACHINE, _ "Software\Microsoft\Windows\CurrentVersion\App Paths\outlook.exe", "") 'Open The Orders Folder strFileName = StrAppName & " /select outlook:" & FolderToOpen Shell strFileName, vbNormalFocus Screen.MousePointer = vbDefault 'another way 'In this version the folder name can't have a space in it 'this is a limitation of this version 'also i think it has bugs as i mucked around 'with it then changed to the version above 'without fixing this version 'use for testing ' Dim olMAPI As Outlook.NameSpace ' Dim Folder As Outlook.MAPIFolder ' Const FOLDER_TO_OPEN = "Mailbox - Orders" '& FolderToOpen '"blah_Blah" 'Modify as appropriate ' ' Set olMAPI = GetObject("", "Outlook.Application").GetNamespace("MAPI") ' Call PrintFolderNames(olMAPI.Folders(FolderToOpen), "->") ' Set olMAPI = Nothing End Sub 'i Got this off the web.. Public Function GetRegStringValue$(Where, sKeyName$, sValueName$) Dim lRetVal As Long 'result of the API functions Dim hKey As Long 'handle of opened key lRetVal = RegOpenKeyEx(Where, sKeyName$, 0, KEY_QUERY_VALUE, hKey) Dim cch As Long Dim lrc As Long Dim lType As Long Dim sValue As String lrc = RegQueryValueExNULL(hKey, sValueName, 0&, lType, 0&, cch) GetRegStringValue$ = Space$(cch) lrc = RegQueryValueExString(hKey, sValueName, 0&, lType, GetRegStringValue$, cch) If lrc = 0 Then GetRegStringValue$ = Left$(GetRegStringValue$, cch - 1) RegCloseKey hKey End Function
:wave:
with respect
bindu
I had these Outlook command-line switches at home.
Use the /Recycle to use a current open instance or the /Folder switch.
Code:Command-Line switch Purpose
------------------- -------
/CleanFreeBusy Cleans and regenerates free/busy information.
/CleanReminders Cleans and regenerates reminders.
/CleanViews Restores default views.
/ResetFolders Restores missing folders for the default delivery location.
/ResetFolderNames Resets the language of the default folders to the language of the Outlook client.
/ResetOutlookBar Rebuilds the Outlook Bar.
/NoPreview Turns off the Preview pane at startup.
/CleanSchedPlus Deletes all Schedule+ data (free/busy, permissions, and .cal file) from the server.
/Safe Starts Outlook without extensions, preview pane, or toolbar customization.
/Recycle Activates an existing Outlook window.
/Folder Opens new window in "folder" mode (Outlook Bar and Folder List off).
/Profiles Shows MAPI Profiles dialog box regardless of the options setting on the Tools menu.
/Profile <profilename> Loads specified profile. (If your profile contains a space, Outlook may treat it as
an invalid profile name when using this switch. Work around this by wrapping the
profile name in quotes.)
/s <filename> Loads specified shortcuts file (.fav file).
/f <msgfilename> Opens <msgfilename>.
/p <msgfilename> Prints <msgfilename>. Same as /f except is associated with the print verb instead of open.
/Embedding <msgfilename> Used to open a .msg file as an OLE embedding. Standard OLE command-line argument.
/c <messageclass> Creates a new item of the specified message class (Outlook forms or any other valid MAPI
form).
/a path:\<filename> Opens a new e-mail message with the specified file attached.
/importprf <path\.prf filename> Creates an Outlook profile based on the information in the specified .prf file.
Also Pirre001,
don't forget to make sure you create some Tasks in the Outlook
Tasks folder before you execute the Task export function.
RobDog888,
It works now!!!
Everything!!
Thanks!!
When more than one file is attached into the mail the path to the files are saved to two or more rows in access.
Like this:
C:\testfile1
C:\testfile2
How should I do to open the files at the same time, when they are more than one?
I'm just wondering if the taskfolder is inkluded in Outlook.pst file, or is it a file of it's own?
You welcome.
Glad to here things are working fine.
To open more than one file you could always change the code to
use a ; instead of a vbNewLine after each file entered into
sAttachment. Then when you need to open the files you can split
the field on the ; and open each one after another.
C:\test1.txt;C:\test2.txt....
The pst file will contain all personal folders.
HTH
These commands are to send attachements but the one i need doesn't work even tho the file exists..
VB Code:
'this does not work Open_Out_Folder "/a " & DefOutPutFolder & "\Order 38104540 From q 17Sep20031943.txt", 1 'nor does this Open_Out_Folder "/a C:\Order 38104540 From q 17Sep20031943.txt", 1 'but this does, god knows why 'maybe it is to do with the long filename? Open_Out_Folder "/a C:\autoexec.bat", 1 Public Sub Open_Out_Folder(FolderToOpen As String, intview As Integer) Dim strFileName As String, wShell As Object, StrAppName As String Screen.MousePointer = vbHourglass 'get the path to outlook from the registry StrAppName = GetRegStringValue$(HKEY_LOCAL_MACHINE, _ "Software\Microsoft\Windows\CurrentVersion\App Paths\outlook.exe", "") Select Case intview Case 0 'The folder name can't have a space in it 'Open The Folder strFileName = StrAppName & " /select outlook:" & FolderToOpen Case 1 'StickyNote Appointment Task Send an attached file strFileName = StrAppName & " " & FolderToOpen End Select Shell strFileName, vbNormalFocus Screen.MousePointer = vbDefault 'DONT DELETE ME ' Dim olMAPI As Outlook.NameSpace ' Dim Folder As Outlook.MAPIFolder ' Const FOLDER_TO_OPEN = "Mailbox - Orders" '& FolderToOpen '"Mailbox - John Doe" 'Modify as appropriate ' ' Set olMAPI = GetObject("", "Outlook.Application").GetNamespace("MAPI") ' Call PrintFolderNames(olMAPI.Folders(FolderToOpen), "->") ' Set olMAPI = Nothing End Sub
i need to send the long filename..
if you know how it would be appreciated...
with respect
:wave:
bindu
The switch does not like spaces in the file path.
Rename the files using underscores or something and then try again.
do you have a function that can replace the spaces with u
underscores. i am lazy to write one....
but if not i guess i will have to
:D
bindu
Yes, there is one, but I can't take the credit for it.
Microsoft wrote it. Its called Replace.
Code:sFileName = Replace(sFileName, Chr(32), "_", 1)
thanks for all your input robdog... and good luck to you Steve
This might be useful ....
:wave:
i have placed the a full explanation in the code in the codebank along with a module of the functions in a zip
bindu
RobDog888,
I have a problem that I can't solve, I know you told me how I should do, but I cant' solve it anyway...
When more than one file is attached into a mail or a task I use
; after each file entered into sAttachment.
I have created a form in access which shows my imported mail or tasks in a textbox.
The problem is that I want to show all attached files in the current mail or task in the form. How Can I in a good way show all attached files, and with a mouseclick open the file I want to see.
I know you han help me with this...:cool:
Sorry for the delay, but I went to Las Vegas for a week with my
wife. We went to a business expo for her job.
Use a combo box on your Access form and populate it with the
attachments. If there are no attachments then disable the
combo. Split the Attachment field on the semi-colon using the
Split command. Then when the user clicks an item in the combo
box, shell it out using the file path.