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

Referencing Excel cell from Outlook VBA



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5  
Old March 23rd 07, 06:36 PM posted to microsoft.public.outlook.program_vba
expect_ed
external usenet poster
 
Posts: 13
Default Referencing Excel cell from Outlook VBA

Thanks again Michael. I figured out the Workbood.Open syntax and got it to
work
BUT
When I tried using your example i could not get it working, so I tried it in
a macro by itself to isolate the problem and found:
Macro breaks with a "Compile error: User-Defined type not defined"
Choosing debug and
The Sub line is hilighted in yellow [Sub UseXl()]
The line: Dim xl as Excel.Application is hilighted in black starting with
xl.

What am I missing??
Thanks


"Michael Bauer [MVP - Outlook]" wrote:



Please see the Workbooks.Open function.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - The most effective way to assign Outlook categories:
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)


Am Fri, 23 Mar 2007 05:51:13 -0700 schrieb expect_ed:

Michael, that is excellent. It would have taken me another 2 days work or
more to figure that out on my own. My co-workers are going to think I'm a
genius thanks to you (of course I'm taking all the credit ; }.

Sorry to be a pest but just one more thing to make it really functional.
Given the path to the workbook can I force the worksheet open from within
Outlook? How might I go about that?

Thanks again for your help.
ed

"Michael Bauer [MVP - Outlook]" wrote:


Assuming that Excel is running and the workbook is open:

Dim xl as Excel.Application
Dim wb as Excel.Workbook
Dim ws as Excel.Worksheet
Dim rn as Excel.Range
Dim TargetFolder as string

Set xl=GetObject(,"Excel.Application")
Set wb=xl.Workbooks("Bookname")
Set ws=wb.Sheets(1)
Set rn=ws.Range("project 1")

TargetFolder=rn.Value

As you can see you can name a cell in Excel. For instance, write the

folder
name for project 1 into cell B2 and name that cell 'project 1'. then you

can
even change the cell later without having to rewrite code.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - The most effective way to assign Outlook categories:
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Thu, 22 Mar 2007 14:25:21 -0700 schrieb expect_ed:

My apologies if this is a redundant post. I responded to a thread from

Jan
but it appears there is not a view that shows new replies. If I missed

it
I
apologize.

My issue is this:
I have about 2 dozen projects active at any one time which change week

by
week. I am set up now with macros/toolbars/keyboard shortcuts to route

the
selected message to their respective project folders by keybrd shortcut.

I would like to be able to edit the routing without having to go into

VBA
and edit code every time. Is it possible to create an array in excel
which
would list the ALT key and the target folder and have the seperate

Outlook
VBA subroutines reference a cell in that array to know which folder to
route
to. Then I could easily change the routing by editing the excel sheet
rather
than digging into code each time. This would also make the solution more
easily distributable to my co-workers who could edit their own excel
sheets
but are not capable of editing VBA.

So my Macro now is:
Application.ActiveExplorer.Selection.Item(1).Move
Application.GetNamespace("MAPI").Folders("Archival
Folder").Folders("Target
Folder")

I think "all" I need to do is replace the "Target Folder" with a

reference
to the specific excel cell. Is that possible?? A specific example

would
be
helpful.

TIA
ed


 




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
VBA Clipboard Cut & Paste from Excel to Outlook andy Outlook and VBA 15 May 14th 08 07:32 AM
Check if appointment exists ( by subject ) in Outlook from Excel VBA Bart Outlook and VBA 3 January 22nd 07 09:26 PM
email from excel cell Ben Outlook and VBA 1 January 8th 07 05:15 PM
Multi-line addresses in one Excel cell CP Outlook - Using Contacts 1 October 23rd 06 11:59 PM
Export DL members to Excel CSV with Outlook VBA [email protected] Outlook and VBA 0 March 17th 06 09:04 PM


All times are GMT +1. The time now is 10:29 PM.


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