ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Close a Folder (https://www.excelbanter.com/excel-discussion-misc-queries/49955-close-folder.html)

aftamath

Close a Folder
 
Here is the VBA code used to open a folder from a command button;

Private Sub Go1_Click()

ActiveWorkbook.FollowHyperlink Address:="D:\Documents and
Settings\Desktop\Products\" & ComboBox1, _
NewWindow:=True

ActiveWorkbook.Address("D:\Documents and Settings\Michael
Groll\Desktop\Products\Honeywell").Close

End Sub

The second item in the code isn't correct at all for closing the folder. Is
it possible with VBA and, if so, how do I write the code. Thanks

Bob Phillips

Activeworkbook.Close

--
HTH

Bob Phillips

"aftamath" wrote in message
...
Here is the VBA code used to open a folder from a command button;

Private Sub Go1_Click()

ActiveWorkbook.FollowHyperlink Address:="D:\Documents and
Settings\Desktop\Products\" & ComboBox1, _
NewWindow:=True

ActiveWorkbook.Address("D:\Documents and Settings\Michael
Groll\Desktop\Products\Honeywell").Close

End Sub

The second item in the code isn't correct at all for closing the folder.

Is
it possible with VBA and, if so, how do I write the code. Thanks




aftamath

I don't want to close the workbook I'm working in. I want to close the
folder I just opened using the first codeline.

"Bob Phillips" wrote:

Activeworkbook.Close

--
HTH

Bob Phillips

"aftamath" wrote in message
...
Here is the VBA code used to open a folder from a command button;

Private Sub Go1_Click()

ActiveWorkbook.FollowHyperlink Address:="D:\Documents and
Settings\Desktop\Products\" & ComboBox1, _
NewWindow:=True

ActiveWorkbook.Address("D:\Documents and Settings\Michael
Groll\Desktop\Products\Honeywell").Close

End Sub

The second item in the code isn't correct at all for closing the folder.

Is
it possible with VBA and, if so, how do I write the code. Thanks





Bob Phillips

You don't open a folder, you open workbooks or files. You reference folders.
Thus, you cannot close something that is not opened.

--
HTH

Bob Phillips

"aftamath" wrote in message
...
I don't want to close the workbook I'm working in. I want to close the
folder I just opened using the first codeline.

"Bob Phillips" wrote:

Activeworkbook.Close

--
HTH

Bob Phillips

"aftamath" wrote in message
...
Here is the VBA code used to open a folder from a command button;

Private Sub Go1_Click()

ActiveWorkbook.FollowHyperlink Address:="D:\Documents and
Settings\Desktop\Products\" & ComboBox1, _
NewWindow:=True

ActiveWorkbook.Address("D:\Documents and Settings\Michael
Groll\Desktop\Products\Honeywell").Close

End Sub

The second item in the code isn't correct at all for closing the

folder.
Is
it possible with VBA and, if so, how do I write the code. Thanks







aftamath

This code opens a folder in a new window. ComboBox1 is a string selected by
the user to open a folder. I know that it opens a folder because I ran it
and it works. The folder opens up right on the screen. Perhaps there's
isn't a code to close the non-application specific folder.

"Bob Phillips" wrote:

You don't open a folder, you open workbooks or files. You reference folders.
Thus, you cannot close something that is not opened.

--
HTH

Bob Phillips

"aftamath" wrote in message
...
I don't want to close the workbook I'm working in. I want to close the
folder I just opened using the first codeline.

"Bob Phillips" wrote:

Activeworkbook.Close

--
HTH

Bob Phillips

"aftamath" wrote in message
...
Here is the VBA code used to open a folder from a command button;

Private Sub Go1_Click()

ActiveWorkbook.FollowHyperlink Address:="D:\Documents and
Settings\Desktop\Products\" & ComboBox1, _
NewWindow:=True

ActiveWorkbook.Address("D:\Documents and Settings\Michael
Groll\Desktop\Products\Honeywell").Close

End Sub

The second item in the code isn't correct at all for closing the

folder.
Is
it possible with VBA and, if so, how do I write the code. Thanks







Bob Phillips

What is the name of this 'folder' that it opens, and what exactly do you
mean by 'open'?

--
HTH

Bob Phillips

"aftamath" wrote in message
...
This code opens a folder in a new window. ComboBox1 is a string selected

by
the user to open a folder. I know that it opens a folder because I ran it
and it works. The folder opens up right on the screen. Perhaps there's
isn't a code to close the non-application specific folder.

"Bob Phillips" wrote:

You don't open a folder, you open workbooks or files. You reference

folders.
Thus, you cannot close something that is not opened.

--
HTH

Bob Phillips

"aftamath" wrote in message
...
I don't want to close the workbook I'm working in. I want to close

the
folder I just opened using the first codeline.

"Bob Phillips" wrote:

Activeworkbook.Close

--
HTH

Bob Phillips

"aftamath" wrote in message
...
Here is the VBA code used to open a folder from a command button;

Private Sub Go1_Click()

ActiveWorkbook.FollowHyperlink Address:="D:\Documents and
Settings\Desktop\Products\" & ComboBox1, _
NewWindow:=True

ActiveWorkbook.Address("D:\Documents and Settings\Michael
Groll\Desktop\Products\Honeywell").Close

End Sub

The second item in the code isn't correct at all for closing the

folder.
Is
it possible with VBA and, if so, how do I write the code. Thanks










All times are GMT +1. The time now is 02:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com