Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Excell FileOPenDialog from another App, and listbox multiselect problems

I have 2 problems -
First, I am using a list box and have "multi-select extended" enabled. When
I click in the box, I want to enable a button if an item is selected,
disable if no items are selected. Problem is, with multi select enabled, my
box won't detect the click. With simple select, this works, but I want
multi. Am i missing something obvious?

Problem 2 :
I am running a vba macro from another application, which it appears doesn't
have a File open Dialog box.
I thought I could use the Excel GetOpenFileName Dialog (code follows)
This works, but obviously I'm doing something wrong here, because I get a
"Server Busy - Switch Apps or Retry" Dialog right after the GetOpenFileName
closes (gives me the filename, but this dialog warning is annoying)
Could someone tell me what I'm doing wrong here, too?

Private Sub btnBrowse_Click()
On Error GoTo Err_btnBrowse_Click
Dim fl As File
Dim eApp As New Excel.Application
'Get the path to a file with the file open dialog box
Set fl = fso.GetFile(eApp.GetOpenFilename)
eApp.Quit
Set eApp = Nothing
txtDirectory.Value = fl.ParentFolder

Err_btnBrowse_Click:
'Do Nothing
End Sub

Thanks in Advance...

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excell FileOPenDialog from another App, and listbox multiselect problems

The change event will fire on each selection

in your second problem, why do you start a new instance of Excel. If your
code resides in Excel, you don't need to start a new instance to use the
getopenfilename.

--
Regards,
Tom Ogilvy

"What-a-Tool" wrote in message
news:20p6d.18075$3n.6656@okepread06...
I have 2 problems -
First, I am using a list box and have "multi-select extended" enabled.

When
I click in the box, I want to enable a button if an item is selected,
disable if no items are selected. Problem is, with multi select enabled,

my
box won't detect the click. With simple select, this works, but I want
multi. Am i missing something obvious?

Problem 2 :
I am running a vba macro from another application, which it appears

doesn't
have a File open Dialog box.
I thought I could use the Excel GetOpenFileName Dialog (code follows)
This works, but obviously I'm doing something wrong here, because I get a
"Server Busy - Switch Apps or Retry" Dialog right after the

GetOpenFileName
closes (gives me the filename, but this dialog warning is annoying)
Could someone tell me what I'm doing wrong here, too?

Private Sub btnBrowse_Click()
On Error GoTo Err_btnBrowse_Click
Dim fl As File
Dim eApp As New Excel.Application
'Get the path to a file with the file open dialog box
Set fl = fso.GetFile(eApp.GetOpenFilename)
eApp.Quit
Set eApp = Nothing
txtDirectory.Value = fl.ParentFolder

Err_btnBrowse_Click:
'Do Nothing
End Sub

Thanks in Advance...

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Excell FileOPenDialog from another App, and listbox multiselect problems

Thanks for the help with the list box problem. That, I AM using in an excel
macro. Could not figure out why the click event wouldn't work. Change event
isn't perfect for me, but I can get things working.

The other problem is not from an excel macro. That is for a macro I'm
writing in a program called SolidWorks.
I know it doesn't really belong in this group, but seeing as this group IS
full of vb experts, I was hoping someone would see my error (other than the
wrong group posting, that is)

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"Tom Ogilvy" wrote in message
...
The change event will fire on each selection

in your second problem, why do you start a new instance of Excel. If your
code resides in Excel, you don't need to start a new instance to use the
getopenfilename.

--
Regards,
Tom Ogilvy

"What-a-Tool" wrote in message
news:20p6d.18075$3n.6656@okepread06...
I have 2 problems -
First, I am using a list box and have "multi-select extended" enabled.

When
I click in the box, I want to enable a button if an item is selected,
disable if no items are selected. Problem is, with multi select enabled,

my
box won't detect the click. With simple select, this works, but I want
multi. Am i missing something obvious?

Problem 2 :
I am running a vba macro from another application, which it appears

doesn't
have a File open Dialog box.
I thought I could use the Excel GetOpenFileName Dialog (code follows)
This works, but obviously I'm doing something wrong here, because I get

a
"Server Busy - Switch Apps or Retry" Dialog right after the

GetOpenFileName
closes (gives me the filename, but this dialog warning is annoying)
Could someone tell me what I'm doing wrong here, too?

Private Sub btnBrowse_Click()
On Error GoTo Err_btnBrowse_Click
Dim fl As File
Dim eApp As New Excel.Application
'Get the path to a file with the file open dialog box
Set fl = fso.GetFile(eApp.GetOpenFilename)
eApp.Quit
Set eApp = Nothing
txtDirectory.Value = fl.ParentFolder

Err_btnBrowse_Click:
'Do Nothing
End Sub

Thanks in Advance...

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Excell FileOPenDialog from another App, and listbox multiselect problems

Sean,
Does this SolidWorks have a VBA interface ?

NickHK

"What-a-Tool" wrote in message
news:gRH6d.28344$cN6.26875@lakeread02...
Thanks for the help with the list box problem. That, I AM using in an

excel
macro. Could not figure out why the click event wouldn't work. Change

event
isn't perfect for me, but I can get things working.

The other problem is not from an excel macro. That is for a macro I'm
writing in a program called SolidWorks.
I know it doesn't really belong in this group, but seeing as this group IS
full of vb experts, I was hoping someone would see my error (other than

the
wrong group posting, that is)

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"Tom Ogilvy" wrote in message
...
The change event will fire on each selection

in your second problem, why do you start a new instance of Excel. If

your
code resides in Excel, you don't need to start a new instance to use the
getopenfilename.

--
Regards,
Tom Ogilvy

"What-a-Tool" wrote in

message
news:20p6d.18075$3n.6656@okepread06...
I have 2 problems -
First, I am using a list box and have "multi-select extended" enabled.

When
I click in the box, I want to enable a button if an item is selected,
disable if no items are selected. Problem is, with multi select

enabled,
my
box won't detect the click. With simple select, this works, but I want
multi. Am i missing something obvious?

Problem 2 :
I am running a vba macro from another application, which it appears

doesn't
have a File open Dialog box.
I thought I could use the Excel GetOpenFileName Dialog (code follows)
This works, but obviously I'm doing something wrong here, because I

get
a
"Server Busy - Switch Apps or Retry" Dialog right after the

GetOpenFileName
closes (gives me the filename, but this dialog warning is annoying)
Could someone tell me what I'm doing wrong here, too?

Private Sub btnBrowse_Click()
On Error GoTo Err_btnBrowse_Click
Dim fl As File
Dim eApp As New Excel.Application
'Get the path to a file with the file open dialog box
Set fl = fso.GetFile(eApp.GetOpenFilename)
eApp.Quit
Set eApp = Nothing
txtDirectory.Value = fl.ParentFolder

Err_btnBrowse_Click:
'Do Nothing
End Sub

Thanks in Advance...

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Excell FileOPenDialog from another App, and listbox multiselect problems

Yes it does. Its a VBA macro that I am writing for it.

This is what I got on the SW NewsGroup (From: "That70sTick"):

<<<<<The Windows Common Dialog object used for
opening/saving/colors/priniting is not licensed for use in SW VBA. You
have to access it using Windows API calls (Declare...etc.).

I could do this, but its a lot of code. Probably will end up going with
this, unless someone has a solution for using the Excel application dialog?

The easiest way to do it is by declaring the Excel application object and
using the GetOpenFileName Dialog from that. (Well, it would be if it worked
properly, anyway - but it doesn't). Gives me the "Server is Busy - Retry or
Switch" message. I'm not on a network, either

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"NickHK" wrote in message
...
Sean,
Does this SolidWorks have a VBA interface ?

NickHK

"What-a-Tool" wrote in message
news:gRH6d.28344$cN6.26875@lakeread02...
Thanks for the help with the list box problem. That, I AM using in an

excel
macro. Could not figure out why the click event wouldn't work. Change

event
isn't perfect for me, but I can get things working.

The other problem is not from an excel macro. That is for a macro I'm
writing in a program called SolidWorks.
I know it doesn't really belong in this group, but seeing as this group

IS
full of vb experts, I was hoping someone would see my error (other than

the
wrong group posting, that is)

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"Tom Ogilvy" wrote in message
...
The change event will fire on each selection

in your second problem, why do you start a new instance of Excel. If

your
code resides in Excel, you don't need to start a new instance to use

the
getopenfilename.

--
Regards,
Tom Ogilvy

"What-a-Tool" wrote in

message
news:20p6d.18075$3n.6656@okepread06...
I have 2 problems -
First, I am using a list box and have "multi-select extended"

enabled.
When
I click in the box, I want to enable a button if an item is

selected,
disable if no items are selected. Problem is, with multi select

enabled,
my
box won't detect the click. With simple select, this works, but I

want
multi. Am i missing something obvious?

Problem 2 :
I am running a vba macro from another application, which it appears
doesn't
have a File open Dialog box.
I thought I could use the Excel GetOpenFileName Dialog (code

follows)
This works, but obviously I'm doing something wrong here, because I

get
a
"Server Busy - Switch Apps or Retry" Dialog right after the
GetOpenFileName
closes (gives me the filename, but this dialog warning is annoying)
Could someone tell me what I'm doing wrong here, too?

Private Sub btnBrowse_Click()
On Error GoTo Err_btnBrowse_Click
Dim fl As File
Dim eApp As New Excel.Application
'Get the path to a file with the file open dialog box
Set fl = fso.GetFile(eApp.GetOpenFilename)
eApp.Quit
Set eApp = Nothing
txtDirectory.Value = fl.ParentFolder

Err_btnBrowse_Click:
'Do Nothing
End Sub

Thanks in Advance...

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Excell FileOPenDialog from another App, and listbox multiselect problems

Sean,
Go the API way. It's not much code and will avoid your Excel problems.

NicHK

"What-a-Tool" wrote in message
news:jPl7d.28400$cN6.3578@lakeread02...
Yes it does. Its a VBA macro that I am writing for it.

This is what I got on the SW NewsGroup (From: "That70sTick"):

<<<<<The Windows Common Dialog object used for
opening/saving/colors/priniting is not licensed for use in SW VBA. You
have to access it using Windows API calls (Declare...etc.).

I could do this, but its a lot of code. Probably will end up going with
this, unless someone has a solution for using the Excel application

dialog?

The easiest way to do it is by declaring the Excel application object and
using the GetOpenFileName Dialog from that. (Well, it would be if it

worked
properly, anyway - but it doesn't). Gives me the "Server is Busy - Retry

or
Switch" message. I'm not on a network, either

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"NickHK" wrote in message
...
Sean,
Does this SolidWorks have a VBA interface ?

NickHK

"What-a-Tool" wrote in

message
news:gRH6d.28344$cN6.26875@lakeread02...
Thanks for the help with the list box problem. That, I AM using in an

excel
macro. Could not figure out why the click event wouldn't work. Change

event
isn't perfect for me, but I can get things working.

The other problem is not from an excel macro. That is for a macro I'm
writing in a program called SolidWorks.
I know it doesn't really belong in this group, but seeing as this

group
IS
full of vb experts, I was hoping someone would see my error (other

than
the
wrong group posting, that is)

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"Tom Ogilvy" wrote in message
...
The change event will fire on each selection

in your second problem, why do you start a new instance of Excel.

If
your
code resides in Excel, you don't need to start a new instance to use

the
getopenfilename.

--
Regards,
Tom Ogilvy

"What-a-Tool" wrote in

message
news:20p6d.18075$3n.6656@okepread06...
I have 2 problems -
First, I am using a list box and have "multi-select extended"

enabled.
When
I click in the box, I want to enable a button if an item is

selected,
disable if no items are selected. Problem is, with multi select

enabled,
my
box won't detect the click. With simple select, this works, but I

want
multi. Am i missing something obvious?

Problem 2 :
I am running a vba macro from another application, which it

appears
doesn't
have a File open Dialog box.
I thought I could use the Excel GetOpenFileName Dialog (code

follows)
This works, but obviously I'm doing something wrong here, because

I
get
a
"Server Busy - Switch Apps or Retry" Dialog right after the
GetOpenFileName
closes (gives me the filename, but this dialog warning is

annoying)
Could someone tell me what I'm doing wrong here, too?

Private Sub btnBrowse_Click()
On Error GoTo Err_btnBrowse_Click
Dim fl As File
Dim eApp As New Excel.Application
'Get the path to a file with the file open dialog box
Set fl = fso.GetFile(eApp.GetOpenFilename)
eApp.Quit
Set eApp = Nothing
txtDirectory.Value = fl.ParentFolder

Err_btnBrowse_Click:
'Do Nothing
End Sub

Thanks in Advance...

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)












  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Excell FileOPenDialog from another App, and listbox multiselect problems

Thanks for the advice. Will do.

Not often that the easy way out is the right way out I guess.
--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"NickHK" wrote in message
...
Sean,
Go the API way. It's not much code and will avoid your Excel problems.

NicHK

"What-a-Tool" wrote in message
news:jPl7d.28400$cN6.3578@lakeread02...
Yes it does. Its a VBA macro that I am writing for it.

This is what I got on the SW NewsGroup (From: "That70sTick"):

<<<<<The Windows Common Dialog object used for
opening/saving/colors/priniting is not licensed for use in SW VBA. You
have to access it using Windows API calls (Declare...etc.).

I could do this, but its a lot of code. Probably will end up going with
this, unless someone has a solution for using the Excel application

dialog?

The easiest way to do it is by declaring the Excel application object

and
using the GetOpenFileName Dialog from that. (Well, it would be if it

worked
properly, anyway - but it doesn't). Gives me the "Server is Busy - Retry

or
Switch" message. I'm not on a network, either

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"NickHK" wrote in message
...
Sean,
Does this SolidWorks have a VBA interface ?

NickHK

"What-a-Tool" wrote in

message
news:gRH6d.28344$cN6.26875@lakeread02...
Thanks for the help with the list box problem. That, I AM using in

an
excel
macro. Could not figure out why the click event wouldn't work.

Change
event
isn't perfect for me, but I can get things working.

The other problem is not from an excel macro. That is for a macro

I'm
writing in a program called SolidWorks.
I know it doesn't really belong in this group, but seeing as this

group
IS
full of vb experts, I was hoping someone would see my error (other

than
the
wrong group posting, that is)

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"Tom Ogilvy" wrote in message
...
The change event will fire on each selection

in your second problem, why do you start a new instance of Excel.

If
your
code resides in Excel, you don't need to start a new instance to

use
the
getopenfilename.

--
Regards,
Tom Ogilvy

"What-a-Tool" wrote in
message
news:20p6d.18075$3n.6656@okepread06...
I have 2 problems -
First, I am using a list box and have "multi-select extended"

enabled.
When
I click in the box, I want to enable a button if an item is

selected,
disable if no items are selected. Problem is, with multi select
enabled,
my
box won't detect the click. With simple select, this works, but

I
want
multi. Am i missing something obvious?

Problem 2 :
I am running a vba macro from another application, which it

appears
doesn't
have a File open Dialog box.
I thought I could use the Excel GetOpenFileName Dialog (code

follows)
This works, but obviously I'm doing something wrong here,

because
I
get
a
"Server Busy - Switch Apps or Retry" Dialog right after the
GetOpenFileName
closes (gives me the filename, but this dialog warning is

annoying)
Could someone tell me what I'm doing wrong here, too?

Private Sub btnBrowse_Click()
On Error GoTo Err_btnBrowse_Click
Dim fl As File
Dim eApp As New Excel.Application
'Get the path to a file with the file open dialog box
Set fl = fso.GetFile(eApp.GetOpenFilename)
eApp.Quit
Set eApp = Nothing
txtDirectory.Value = fl.ParentFolder

Err_btnBrowse_Click:
'Do Nothing
End Sub

Thanks in Advance...

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't

work."
- Thomas Alva Edison (1847-1931)














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
Multiselect Listbox use RKS Excel Discussion (Misc queries) 1 May 12th 06 03:04 PM
Multiselect listbox selection question Paul Mueller Excel Programming 3 June 16th 04 09:25 PM
MultiSelect ListBox in Excel PeteSmith Excel Programming 1 April 20th 04 11:14 AM
Excel VBA-Looping though MultiSelect on ListBox jpendegraft[_3_] Excel Programming 2 February 3rd 04 04:38 PM
multiselect listbox CG Rosén Excel Programming 2 December 28th 03 05:17 PM


All times are GMT +1. The time now is 09:17 PM.

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"