Free Microsoft Excel 2013
Quick Reference
Free Microsoft 2013 Quick Reference Guide

Free Microsoft Excel 2013 Quick Reference

Open Outlook .Msg file from excel vba form

Hi ,
i want to open an .msg file using command button which is in form.
I can able to create a new mail but not able to open existing.msg from a predifined path.
thanks...!


	VB:
	
 Mail_Object = CreateObject("Outlook.Application") 
Set Mail_Single = Mail_Object.CreateItem(0) 
With Mail_Single 
    .Display "C:data.msg" 
End With 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines


Post your answer or comment

comments powered by Disqus
how can i restrict a user from opening a dbf file from excel? and how can i
restrict him from saving an excel file as DBF? thanks

What is the code to open a Access file from excel?

Hi
I am creating a document catalogue in xl, listing documenst of several
types, e.g. xls, doc, msg, pdf etc I have the code to open xls files
from excel, and the code for word dobuments. However a couple three
things I am seeking:

1. Code to open and Outlook Email file from xl.
2. Code to open and Outlook Email file from xl.
3. Word. Currently the code will open a Word document, but it opens
another Word program each time. I am looking for code which will
figure out if Word is already open, and if so, only open the file
requested, not an entire new Word program.

If anyone can help in these items, it would be most appreciated. I
have done a search of the newsgroup and have seen several notes
approximating what I am seeking, but so far, not specifically what I am

seeking.

If anyone can help in these items, it would be most appreciated

Hi,

I am trying to execute a batch file from Excel macro using the below commands...
stArgs = "C:datasheetsftp1.bat"
retval = Shell(stArgs)

ftp1.bat has the following content
@echo off
ftp -n -v -s:c:datasheetsftpinput.txt
pause

(I have added the pause command to debug the problem)
Now when I run the macro, command prompt is opening up, but showing me the message , "error cannot open ftpinput.txt."

If I double click on the ftp1.bat outside the macro , it is working fine.

How to open the txt file from Excel Macro?

Please help me

Thanks.

I am trying to extract the date so I can get around the problem of MSG files getting the current time stamp when saved to the file system. I have looked at the MSG files with Wordpad and there is a lot of binary stuff at the beginning, but then what I want looks approximately like this:

R e c e i v e d d a t e : J u n 5 , 2 0 0 1

So what I want to do is retrieve that info and use it to set the MSG file created and modified date. I found an excel macro that does the latter part, but I still need to figure out the first part.

Of course the easy answer would be to buy an archiving program like mail2file, but our IT department doesn't allow us to buy our own software, no matter how cheap and useful <rolleyes>.

Hi Experts,

I need to search & display the access database records from excel vba form in a list box.
assume I have data like
Microbiology
Microtechnology
Microsoft
in access database.
That is If i give a text like Micro in excel vba form text box it have to display all the values from database which contains Micro and display in a list box which is in excel form.

I dont have code.pls help me...

HI,

How do I create a UTF-8 encoded file in excel VBA?

I have tried using filesystem obeject with TriState property to true.
This creates the file in Unicode format but not in UTF-8 format.

Thanks

--
mah_kum_70
------------------------------------------------------------------------
mah_kum_70's Profile: http://www.excelforum.com/member.php...fo&userid=2572
View this thread: http://www.excelforum.com/showthread...hreadid=537492

HI,

How do I create a UTF-8 encoded file in excel VBA?

I have tried using filesystem obeject with TriState property to true. This creates the file in Unicode format but not in UTF-8 format.

Thanks

Hi all!
I´m running an outlook code in excel VBA to open an email, input To and CC addresses, subject, text and an attachment.
What is being really tricky to me is how can i open this attachment.

Private Sub cmd_OK_Click()
Dim newmail As Object
Set newmail = CreateObject("Outlook.Application")
Set NM = newmail.CreateItem(olMailItem)
NM.To = "email1@test.com"
NM.cc = "#email2@test.com"
NM.Subject = "attachment tests"
Set attach = NM.Attachments
attach.Add "c:test.xls"
NM.display
End Sub
this piece of code, creates an objetc (new email), addresses it to email1@test.com, cc it to email2@test.com, with subject "attachment tests", and attaches the spreadsheet test.xls. What i want is to open this attachment from the email opened, not the file save in C:.
Can anyone help me??
Thanks a lot.

If anyone out there can assist me I will be most grateful. I am trying to
open an Access mdb file from VBA within excel and to further open one of the
macros within the mdb file.

If it helps, the purpose of this is to udpate an Access database from some
extremely large spreadsheets from excel so that I can run some killer
financial reports from it. I find that sum-if and vlookups on such large
amounts of data are cumbersome in excel alone. So, I want to do the calcs in
Access through queries and return them into excel. But, as this spreadsheet
is going to be used by others, I want it to be seemless.

I can accomplish the task if I put the following string into Start/Run:

"C:Program FilesMicrosoft OfficeOffice11msaccess.exe" "C:Documents and
SettingsAdministratorMy DocumentsTest DirectoryExcel Access Test Db.mdb"
/Excl /X Macro1"

Please help.

Regards,

Layne

Using Excel VBA, I am trying to copy data from one Excel
file to one Word file, and cycle back and forth between
the two files without opening a new Word file each time I
dump data from Excel into Word. When I use CreateObject,
I get a new instance of the Word file, but I don't know
how to use GetObject to activate an already open Word file
since the Word file is not saved yet and at this point is
just Document1. I don't want 20 instances of Word, just
one, with one Word file to contain all the dumped data.
Any ideas?

emailing files from excel, the files will not go until I open up MS Outlook.
Only then will the file go. I have waited for 30 minutes and more and the
file will not go. IN offices 2000 I never had this problem. any ideas

I am building a database which relies on data generated by an automatic script. This script creates a new directory every day, and each hour a new Excel file is stored as an attachment within a .msg file.

Currently, I have to open each .msg file individually, open the attachment, and then collate the data from each of the 24 files into one spreadsheet. This is then manually imported into my database.

The first file is called Unsuccessful SRC jobs Report.msg, successive ones are named Unsuccessful SRC jobs Report (2).msg etc.

Currently, the code I have looks like this.

	VB:
	
Option Compare Database 
Option Explicit 
 
Public Function Import_SRC() As Boolean 
    Dim v_excel As New Excel.Application 
    Dim v_filename As String 
     
     'Open file browser to allow user to select an SRC message
    v_filename = v_excel.GetOpenFilename 
    v_excel.Quit 
    If v_filename = "False" Then 
        MsgBox "Cancelled, process abandoned" 
    Else 
         'Strips unneccessary characters from filename
        If InStr(1, v_filename, "(") > 0 Then 
            v_filename = Mid(v_filename, 1, InStr(1, v_filename, "(") - 2) 
        Else 
            v_filename = Mid(v_filename, 1, InStr(1, v_filename, ".") - 1) 
        End If 
         
        open_message (v_filename & ".msg") 
    End If 
     
     
End Function 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
The purpose of this is to open a file browser so that the user can browse to the correct daily directory. On selecting any of the 24 messages, I strip the last few digits to leave me with /Unsuccessful SRC jobs Report

Once the path is stored in v_filename, I need code to open each message in turn, open the attachment contained within, and import the data in the spreadsheet into a table called SRC. The first time this is done, it should create the table, successive iterations should append the data.

Any ideas?

Is there a way to opening an excel file while excel VBA Application is running? thanks guys in advance.

I have a text file output from a program that is named “ABC123.exp”. I open up the file with Excel and after manipulating the data with VBA code which includes identifying the Source Path directory(strSourcePath As String ) and the File name (strFileName As String) I want to be able to open up a 'Save As' Window and save the manipulated data into the same Source Path directory(strSourcePath) with the File Name being the prefix of the original with a suffix .txt extension. Ex: “ABC123.txt” instead of “ABC123.exp” and the Save as type: Text (Tab delimited)(*.txt). This way my original data won’t be overwritten. Any VBA code to accomplish this would be most appreciated.
Thanks in advance

Hi everybody,

I have some troubles to open a word file from ACCESS in VBA.

The syntaxI use works only when Word is already opened.

Can U give me a code who works even if Word is closed

I mean a code that open word and open the file without troubles

Thank U

Hi there, I am trying to open an access database from excel by clicking a button. I have assigned the following script and modified it for my own use as according to the microsoft kb.

Private Sub CommandButton2_Click()
'Opens Microsoft Access and the file nwind.mdb
Shell ("c:Program FilesMicrosoft OfficeOFFICE11MSACCESS.exe T:TSD - UKProjectsSteve's ProjectsT3FCRs.mdb")
'Initiates a DDE channel to Microsoft Access
Chan = DDEInitiate("MSACCESS", "system")
'Activates Microsoft Access
Application.ActivateMicrosoftApp xlMicrosoftAccess
'Runs the macro "Sample AutoExec" from the NWIND.MDB file
Application.DDEExecute Chan, "ImportData"
'Terminates the DDE channel
Application.DDETerminate Chan

End Sub The problem I have is that although this does not debug, it does not do what I want it to.

I want this to launch Access, then launch the file FCRs.mdb, then launch the macro ImportData.

What it actually IS doing is the following:

ERROR 1:

Remote Data not accessible.
To access this data Excel needs to start another application. Some legitimate applications on your computer could be used maliciously to spread viruses or damage your computer. Only click yes id you trust the source of this workbook and you want to let the workbook start the application.
Start application 'MSACCESS.EXE'?

Even though access has by now already started anyway, I then click yes.

ERROR 2:

Microsoft Office Access can't find the macro 'DataInput.'
The macro (or its macro group) doesn't exist, or the macro is new but hasn't been saved.
Note that when you enter the macrogroupname.macroname syntax in an argument, you must specify the name the macro's macro group was last saved under.

I then click ok, knowing the macro exists, but soon realising the application has opened, and the macro is trying to open, but the file isnt opening at all.

ERROR 3:

The command line you used to start Microsoft Office Access contains an option that Microsoft Office Access doesn't recognize.
Exit and restart Microsoft Office Access using valid command line options.

I click ok, and get ERROR 3 again.... and again.

ERROR 4:

Microsoft Office Access cant find the database file 'T:TSD.mdb'
Make sure you enterred the correct path and filename.

So now at the end of the cascading messages, i eventually find what seems to be the problem. The macro couldnt be openned because the file wasnt open, because it was looking for T:TSD.mdb, when it is supposed to be looking for T:TSD - UKProjectsSteve's ProjectsT3FCRs.mdb.

My big guess is that this has something to do with spaces in names, because if i change it to T:TSD-UKProjectsSteve'sProjectsT3FCRs.mdb, i get the same problem, but with the full path name, so how do i resolve this problem?

I have the following refferences attached:

Visual Basic for Applications
Microsoft Excel 11.0 Object Library
OLE Automation
Microsoft Office 11.0 Object Library
Microsoft Forms 2.0 Object Library
Microsoft Access 11.0 Object Library
Microsoft ActiveX Data Objects 2.8 Library

Please help


I have written a small app the writes flat text files from excel
(order/routing tickets) and sends them to various different
printers around this place..

it is pretty simple and uses the

Open strfilename For Output Access Write Lock Write As #1
Print #1, " This is where the text goes" & string & ""

formats... I've just been asked to Bold some of the fields...I
don't think that is possible but I can't find any real info...
can someone tell me for sure yes or no?

Please?

I'm suddenly unable to embed an Outlook msg into an Excel spreadsheet, which
I last did on October 21. The only MS update that's been added to my PC is
the latest critical security patch.

My spreadsheet is set up as 2003-compatible and I've saved the Outlook
message to my desktop as type "msg." Within Excel, I try to Insert -->
Object --> Create from File. I browse to find the file, click insert, then
OK, and Excel hangs.

Any suggestions?

Thank you.
--
Mary Ellen Whyte

Opening an .xls file with Excel 2007 from Internet Explorer does not open it maximized

Hi there,

We are upgrading from Office 2003 to Office 2007. We have noticed that opening .xls documents with Excel 2007 from Internet Explorer does not open the document maximized within the Excel application window.

This is causing problems for our users because depending on how the window is displayed, the horizontal and vertical scrollbars are not shown against the edges of the Excel application window. As such, the only way to maximize the window is by double clicking on the document's title bar -- but most users would not be aware of this feature. Here is a screenshot of what I mean:

This problem does not occur with local files. In fact, while it may occur once with a local file, after maximizing the document window inside Excel and closing Excel, reopening the document causes Excel to remember that it was last maximized somehow and therefore displays it maximized.

We can reproduce the problem by opening any .xls from Internet Explorer 8 with Excel 2007 on Windows XP, Windows 7, Windows Server 2008 x64 (running Terminal Services/Remote Desktop Services). E.g., here are a bunch of .xls files you can test with from Bing: http://www.bing.com/search?q=filetype%3Axls.

Has anyone got a solution to this?

Thanks.

Hello, I am opening and running an Access macro from Excel VBA which works perfectly, but each time Access is opened even though it is invisible, it still prompts the user to Cancel, Open, or More Info. I've tried putting all the warnings and alerts on false, but it still opens this prompt. This is a problem because the excel macro does other things before it gets to this point and I don't want the user to have to wait around to press Open before the macro will continue. I've considered using SendKeys, but we all know this is very unreliable. Here's my Excel VBA code. Thanks!


	VB:
	
 Run_Data() 
     
    Dim SrceFile 
    Dim DestFile 
    Dim dbs As Object 
     
    Application.ScreenUpdating = False 
    Application.Calculation = xlCalculationManual 
    Application.DisplayAlerts = False 
    DoCmd.SetWarnings = False 
     
     'Copy old database to new location
    SrceFile = Range("DBpath").Value 
    DestFile = Range("DestPath").Value 
    FileCopy SrceFile, DestFile 
     
     'Run monthly process at new location
    Set dbs = CreateObject("Access.Application") 
    dbs.Visible = False 
    dbs.OpenCurrentDatabase (DestFile) 
    dbs.DoCmd.RunMacro "RunMonthlyProcess" 
    dbs.CloseCurrentDatabase 
    dbs.Quit 
    Set dbs = Nothing 
     
    Application.ScreenUpdating = True 
    Application.DisplayAlerts = True 
    DoCmd.SetWarnings = True 
     
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines


Hello every1

i am writing a macro where in i should be able to open a htm file from a directory and again save it into another directory in the same htm format, but this should happen from inside the excel file

IN DETAIL

i download a htm file everyday from the net and save it to D:Downloaded Filescontract.htm

Then i open the file and copy the data from the htm file to excel, close the htm file and then save it to d:Data2009Nov18-Nov-2009.htm (the date and month is the date when the htm file is downloaded)

My Requirement

when i run the macro the file contract.htm should automatically open and after i copy the data it should automatically rename itself to current date and save itself to the desiganated folder (d:Data2009Nov)[it should save in folder Dec when the december month starts]

Please help me
Thanks in advance
sibalamit

Hi all I'm trying to open a word document from excel using VBA. Here is my code.

Sub Help_Click()

        Dim wdApp As Word.Application, wdDoc As Word.Document
        
        On Error Resume Next
        Set wdApp = GetObject(, "Word.Application")
        If Err.Number <> 0 Then 'Word isn't already running
        Set wdApp = CreateObject("Word.Application")
        End If
        On Error GoTo 0
        
        Set wdDoc = wdApp.Documents.Open(ThisWorkbook.Path & "Help.doc")
    
        wdApp.Visible = True
        
        wdDoc.Activate

End Sub
When I run the code I get the following error "User-defined type not defined". The line of code is highlighted in yellow. Any help will be greatly apprecaited.

Hello. I need to verify from Excel VBA, if there is a new e-mail in
Outlook in-tray, and look inside it for certain keywords, in order to
call a subroutine or not.

Best regards.


No luck finding an answer? You could always try Google.