Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Open existing workbook

Hi all experts,
I have a set (3) of workbooks that open from a shortcut on the desktop. When
the workbooks are open I want to give the user the possibility to open an
already existing workbook to replace one of the open workbooks (the one on
the button to open an existing book) and leave the 2 other workbooks that
are already open. So the user needs to see a windows file list to choose
from, select a file and than the macro should run further.
I have no idea on how to start on this.
Thanks for any valued help.
Daniel


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Open existing workbook

hi,
here is a way to call the open dialog box.

Application.Dialogs(xlDialogOpen).Show

You can work it into your code.
reguards.
-----Original Message-----
Hi all experts,
I have a set (3) of workbooks that open from a shortcut

on the desktop. When
the workbooks are open I want to give the user the

possibility to open an
already existing workbook to replace one of the open

workbooks (the one on
the button to open an existing book) and leave the 2

other workbooks that
are already open. So the user needs to see a windows file

list to choose
from, select a file and than the macro should run further.
I have no idea on how to start on this.
Thanks for any valued help.
Daniel


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Open existing workbook

Not real clear on your situation, but to show the file Open dialog

Dim fName as Variant
chDrive "C"
chDir "C:\MyFolder"
fName = Application.GetOpenFileName()
if fName < False then
workbooks.open fName
End if

The dialog returns the name and path of the file chosen - it doesn't open
it. So you have to open it with workbooks.Open.

--
Regards,
Tom Ogilvy



"Daniel Van Eygen" wrote in message
i.nl...
Hi all experts,
I have a set (3) of workbooks that open from a shortcut on the desktop.

When
the workbooks are open I want to give the user the possibility to open an
already existing workbook to replace one of the open workbooks (the one on
the button to open an existing book) and leave the 2 other workbooks that
are already open. So the user needs to see a windows file list to choose
from, select a file and than the macro should run further.
I have no idea on how to start on this.
Thanks for any valued help.
Daniel




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Open existing workbook

Thanks Frank,
I did some experimenting and came up with this code:

Private Sub CommandButton18_Click()
ChDir "c:\Dunrail\Projects"
Workbooks.Open Application.GetOpenFilename
ChDir "c:\Dunrail"
End Sub

This works fine as long as I select a file. If I hit "cancel" instead I get
an error. How can I trap the error in order to avoid the error message?

Daniel.

"Frank Stone" wrote in message
...
hi,
here is a way to call the open dialog box.

Application.Dialogs(xlDialogOpen).Show

You can work it into your code.
reguards.
-----Original Message-----
Hi all experts,
I have a set (3) of workbooks that open from a shortcut

on the desktop. When
the workbooks are open I want to give the user the

possibility to open an
already existing workbook to replace one of the open

workbooks (the one on
the button to open an existing book) and leave the 2

other workbooks that
are already open. So the user needs to see a windows file

list to choose
from, select a file and than the macro should run further.
I have no idea on how to start on this.
Thanks for any valued help.
Daniel


.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Open existing workbook

See my response for an example.

--
Regards,
Tom Ogilvy

"Daniel Van Eygen" wrote in message
i.nl...
Thanks Frank,
I did some experimenting and came up with this code:

Private Sub CommandButton18_Click()
ChDir "c:\Dunrail\Projects"
Workbooks.Open Application.GetOpenFilename
ChDir "c:\Dunrail"
End Sub

This works fine as long as I select a file. If I hit "cancel" instead I

get
an error. How can I trap the error in order to avoid the error message?

Daniel.

"Frank Stone" wrote in message
...
hi,
here is a way to call the open dialog box.

Application.Dialogs(xlDialogOpen).Show

You can work it into your code.
reguards.
-----Original Message-----
Hi all experts,
I have a set (3) of workbooks that open from a shortcut

on the desktop. When
the workbooks are open I want to give the user the

possibility to open an
already existing workbook to replace one of the open

workbooks (the one on
the button to open an existing book) and leave the 2

other workbooks that
are already open. So the user needs to see a windows file

list to choose
from, select a file and than the macro should run further.
I have no idea on how to start on this.
Thanks for any valued help.
Daniel


.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
When opening existing doc why do I have to click twice to open? vonnie/sellcon Excel Discussion (Misc queries) 2 October 21st 09 05:19 PM
existing workbook,want to create chart-wizard will not open Toby Charts and Charting in Excel 0 November 21st 06 05:24 PM
Can't open existing file LisaK Excel Discussion (Misc queries) 3 April 18th 06 10:14 PM
Blank workbook opens when try to open any existing book poloboyUK Excel Discussion (Misc queries) 2 February 2nd 06 08:35 PM
Open existing Excel file Bill Coupe Excel Discussion (Misc queries) 3 January 18th 05 07:53 PM


All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"