Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open excel after Transfering Data 2

Status
Not open for further replies.

lars7

Technical User
Aug 16, 2005
817
GB
Hi Guy's,

How do I open an excel file after transfering my data into it?

My code for the transfer is:

DoCmd.TransferSpreadsheet acExport, 8, "CreatePayrollTransfer", "C:\Documents and Settings\tmcmeekin1\My Documents\Payroll File", True, ""

and then I would like it to open for viewing.

Thanks in advance.

 
try using GetObject.

I can't remember the exact syntax, but I think it's something like

dim xlapp
set xlapp = GetObject("C:/myFile.xls")

search getobject on google to get exact syntax.
 
FollowHyperlink is very useful:

[tt]FollowHyperlink "C:\Documents and Settings\tmcmeekin1\My Documents\Payroll File.xls"[/tt]
 
If you want to open a specific sheet in a workbook, you can also use:

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.workbooks.Open ("path to file\file.xls")
xlApp.sheets("SheetName").Activate
Dim oApp As Object
 
Thanks Chris68a,

As there will only ever be 1 sheet with this one Remou's works great but I might have need for your's in the future.

Ps, sorry Remou I forgot to say thanks for this :~/
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top