Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 13
Default Closing and reopening the same file

I need a macro to close an open file but without saving its changed content.
Then reopen it again. Hence, the macro will have to be able to read the
filename first and use that name to reopen it. Any help is much appreciated.

TIA
Tom


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Closing and reopening the same file

If you're running this from a different workbook, but want to close the
activeworkbook.

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
set wkbk = workbooks.open(filename:=wkbkfullname)
end with




Tom wrote:

I need a macro to close an open file but without saving its changed content.
Then reopen it again. Hence, the macro will have to be able to read the
filename first and use that name to reopen it. Any help is much appreciated.

TIA
Tom


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Closing and reopening the same file

It won't change the way the code works, but it looks more natural:

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
end with
set wkbk = workbooks.open(filename:=wkbkfullname)




Dave Peterson wrote:

If you're running this from a different workbook, but want to close the
activeworkbook.

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
set wkbk = workbooks.open(filename:=wkbkfullname)
end with



Tom wrote:

I need a macro to close an open file but without saving its changed content.
Then reopen it again. Hence, the macro will have to be able to read the
filename first and use that name to reopen it. Any help is much appreciated.

TIA
Tom


--

Dave Peterson


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 13
Default Closing and reopening the same file

Thank you Dave. That's wonderful. It did exactly what I hoped it would do.
Just a couple of questions:
1. Does Excel capture the name of the active document with the line,
wkbkfullname = .fullname ?
2. The use of dot (.) fascintes me. Where can I find out how else it can be
used? Am not a programmer.

TIA
Tom

"Dave Peterson" wrote in message
...
It won't change the way the code works, but it looks more natural:

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
end with
set wkbk = workbooks.open(filename:=wkbkfullname)




Dave Peterson wrote:

If you're running this from a different workbook, but want to close the
activeworkbook.

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
set wkbk = workbooks.open(filename:=wkbkfullname)
end with



Tom wrote:

I need a macro to close an open file but without saving its changed
content.
Then reopen it again. Hence, the macro will have to be able to read the
filename first and use that name to reopen it. Any help is much
appreciated.

TIA
Tom


--

Dave Peterson


--

Dave Peterson



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Closing and reopening the same file

Check VBA's help for the With statement.

It makes coding easier to type and easier to read.

with workbooks("someworkbookname.xls").worksheets("some name")
.range("a1").value = "hi"
.range("b1:b99").clearcontents
.protect
end with

is easier to type and read than:


workbooks("someworkbookname.xls").worksheets("some name").range("a1").value _
= "hi"

workbooks("someworkbookname.xls").worksheets("some name").range("b1:b99") _
.clearcontents

workbooks("someworkbookname.xls").worksheets("some name").protect

The leading dot means that that property or method (like an adjective and or
verb) belongs to the object that was used in the preceding With statement. In
this case a range object on a certain worksheet in a specific workbook.

And so .fullname belongs to the object Activeworkbook.

..fullname will return the drive\path\filename.ext

..name will return only the filename.ext portion.




Tom wrote:

Thank you Dave. That's wonderful. It did exactly what I hoped it would do.
Just a couple of questions:
1. Does Excel capture the name of the active document with the line,
wkbkfullname = .fullname ?
2. The use of dot (.) fascintes me. Where can I find out how else it can be
used? Am not a programmer.

TIA
Tom

"Dave Peterson" wrote in message
...
It won't change the way the code works, but it looks more natural:

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
end with
set wkbk = workbooks.open(filename:=wkbkfullname)




Dave Peterson wrote:

If you're running this from a different workbook, but want to close the
activeworkbook.

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
set wkbk = workbooks.open(filename:=wkbkfullname)
end with



Tom wrote:

I need a macro to close an open file but without saving its changed
content.
Then reopen it again. Hence, the macro will have to be able to read the
filename first and use that name to reopen it. Any help is much
appreciated.

TIA
Tom

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 13
Default Closing and reopening the same file

Thanks once again. By the way, when I named your original set of codes
"Reload" located in Personal.xls, and then called it inside another
procedure with:
Application.Run "'Personal.xls'!Module10.Reload"
the active document just closed but did not reopen. I wonder why it did not
execute the last line:
set wkbk = workbooks.open(filename:=wkbkfullname)
?

Tom

"Dave Peterson" wrote in message
...
Check VBA's help for the With statement.

It makes coding easier to type and easier to read.

with workbooks("someworkbookname.xls").worksheets("some name")
.range("a1").value = "hi"
.range("b1:b99").clearcontents
.protect
end with

is easier to type and read than:


workbooks("someworkbookname.xls").worksheets("some name").range("a1").value
_
= "hi"

workbooks("someworkbookname.xls").worksheets("some name").range("b1:b99") _
.clearcontents

workbooks("someworkbookname.xls").worksheets("some name").protect

The leading dot means that that property or method (like an adjective and
or
verb) belongs to the object that was used in the preceding With statement.
In
this case a range object on a certain worksheet in a specific workbook.

And so .fullname belongs to the object Activeworkbook.

.fullname will return the drive\path\filename.ext

.name will return only the filename.ext portion.




Tom wrote:

Thank you Dave. That's wonderful. It did exactly what I hoped it would
do.
Just a couple of questions:
1. Does Excel capture the name of the active document with the line,
wkbkfullname = .fullname ?
2. The use of dot (.) fascintes me. Where can I find out how else it can
be
used? Am not a programmer.

TIA
Tom

"Dave Peterson" wrote in message
...
It won't change the way the code works, but it looks more natural:

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
end with
set wkbk = workbooks.open(filename:=wkbkfullname)




Dave Peterson wrote:

If you're running this from a different workbook, but want to close
the
activeworkbook.

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
set wkbk = workbooks.open(filename:=wkbkfullname)
end with



Tom wrote:

I need a macro to close an open file but without saving its changed
content.
Then reopen it again. Hence, the macro will have to be able to read
the
filename first and use that name to reopen it. Any help is much
appreciated.

TIA
Tom

--

Dave Peterson

--

Dave Peterson


--

Dave Peterson



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Closing and reopening the same file

Maybe you made another change you didn't share???

I would have guessed that either the workbook would open or you'd see an error
message.

PS. I use xl2003 and I've modified one of my toolbars this way:

Tools|Customize|Commands Tab|File Category
About half way down the right hand side is: Update File

If I open the file in readonly mode, I can click on this button to close
(reminded to save if necessary) and reopen that file.



Tom wrote:

Thanks once again. By the way, when I named your original set of codes
"Reload" located in Personal.xls, and then called it inside another
procedure with:
Application.Run "'Personal.xls'!Module10.Reload"
the active document just closed but did not reopen. I wonder why it did not
execute the last line:
set wkbk = workbooks.open(filename:=wkbkfullname)
?

Tom

"Dave Peterson" wrote in message
...
Check VBA's help for the With statement.

It makes coding easier to type and easier to read.

with workbooks("someworkbookname.xls").worksheets("some name")
.range("a1").value = "hi"
.range("b1:b99").clearcontents
.protect
end with

is easier to type and read than:


workbooks("someworkbookname.xls").worksheets("some name").range("a1").value
_
= "hi"

workbooks("someworkbookname.xls").worksheets("some name").range("b1:b99") _
.clearcontents

workbooks("someworkbookname.xls").worksheets("some name").protect

The leading dot means that that property or method (like an adjective and
or
verb) belongs to the object that was used in the preceding With statement.
In
this case a range object on a certain worksheet in a specific workbook.

And so .fullname belongs to the object Activeworkbook.

.fullname will return the drive\path\filename.ext

.name will return only the filename.ext portion.




Tom wrote:

Thank you Dave. That's wonderful. It did exactly what I hoped it would
do.
Just a couple of questions:
1. Does Excel capture the name of the active document with the line,
wkbkfullname = .fullname ?
2. The use of dot (.) fascintes me. Where can I find out how else it can
be
used? Am not a programmer.

TIA
Tom

"Dave Peterson" wrote in message
...
It won't change the way the code works, but it looks more natural:

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
end with
set wkbk = workbooks.open(filename:=wkbkfullname)




Dave Peterson wrote:

If you're running this from a different workbook, but want to close
the
activeworkbook.

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
set wkbk = workbooks.open(filename:=wkbkfullname)
end with



Tom wrote:

I need a macro to close an open file but without saving its changed
content.
Then reopen it again. Hence, the macro will have to be able to read
the
filename first and use that name to reopen it. Any help is much
appreciated.

TIA
Tom

--

Dave Peterson

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 13
Default Closing and reopening the same file

"Dave Peterson" wrote in message
...
Maybe you made another change you didn't share???

I don't follow. Do you mean share as in, "Sharing Directory" within MS
Windows Explorer? If so that wasn't the case as all the documents used were
in the same directory location.

I would have guessed that either the workbook would open or you'd see an
error message.

Neither. The active workbook just closed with no error message.

PS. I use xl2003 and I've modified one of my toolbars this way:

Tools|Customize|Commands Tab|File Category
About half way down the right hand side is: Update File

If I open the file in readonly mode, I can click on this button to close
(reminded to save if necessary) and reopen that file.



Tom wrote:

Thanks once again. By the way, when I named your original set of codes
"Reload" located in Personal.xls, and then called it inside another
procedure with:
Application.Run "'Personal.xls'!Module10.Reload"
the active document just closed but did not reopen. I wonder why it did
not
execute the last line:
set wkbk = workbooks.open(filename:=wkbkfullname)
?

Tom

"Dave Peterson" wrote in message
...
Check VBA's help for the With statement.

It makes coding easier to type and easier to read.

with workbooks("someworkbookname.xls").worksheets("some name")
.range("a1").value = "hi"
.range("b1:b99").clearcontents
.protect
end with

is easier to type and read than:


workbooks("someworkbookname.xls").worksheets("some name").range("a1").value
_
= "hi"

workbooks("someworkbookname.xls").worksheets("some name").range("b1:b99")
_
.clearcontents

workbooks("someworkbookname.xls").worksheets("some name").protect

The leading dot means that that property or method (like an adjective
and
or
verb) belongs to the object that was used in the preceding With
statement.
In
this case a range object on a certain worksheet in a specific workbook.

And so .fullname belongs to the object Activeworkbook.

.fullname will return the drive\path\filename.ext

.name will return only the filename.ext portion.




Tom wrote:

Thank you Dave. That's wonderful. It did exactly what I hoped it would
do.
Just a couple of questions:
1. Does Excel capture the name of the active document with the line,
wkbkfullname = .fullname ?
2. The use of dot (.) fascintes me. Where can I find out how else it
can
be
used? Am not a programmer.

TIA
Tom

"Dave Peterson" wrote in message
...
It won't change the way the code works, but it looks more natural:

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
end with
set wkbk = workbooks.open(filename:=wkbkfullname)




Dave Peterson wrote:

If you're running this from a different workbook, but want to close
the
activeworkbook.

Dim wkbkFullName as string
dim wkbk as workbook
with activeworkbook
wkbkfullname = .fullname
.close savechanges:=false
set wkbk = workbooks.open(filename:=wkbkfullname)
end with



Tom wrote:

I need a macro to close an open file but without saving its
changed
content.
Then reopen it again. Hence, the macro will have to be able to
read
the
filename first and use that name to reopen it. Any help is much
appreciated.

TIA
Tom

--

Dave Peterson

--

Dave Peterson

--

Dave Peterson


--

Dave Peterson



  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Closing and reopening the same file

I meant that maybe you made a change to the suggested code and you didn't share
it in your follow-up post. Share your curent version.

But maybe it's the location of the code. If you put it in the activeworkbook's
project, then as soon as the activeworkbook closes, the code stops. It has to
be in a different workbook.


Tom wrote:

"Dave Peterson" wrote in message
...
Maybe you made another change you didn't share???

I don't follow. Do you mean share as in, "Sharing Directory" within MS
Windows Explorer? If so that wasn't the case as all the documents used were
in the same directory location.

I would have guessed that either the workbook would open or you'd see an
error message.

Neither. The active workbook just closed with no error message.

<<snipped
  #10   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 13
Default Closing and reopening the same file

"Dave Peterson" wrote in message
...
I meant that maybe you made a change to the suggested code and you didn't
share
it in your follow-up post. Share your curent version.

In my first reply I pointed out that the codes did exactly as I wanted.
Meaning that they did work. I placed a button
in the toolbar to activate it. Here they a
Sub Reload()

' Reload the active document.
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
Dim wkbkFullName As String
Dim wkbk As Workbook
With ActiveWorkbook
wkbkFullName = .FullName
.Close savechanges:=False
End With
Set wkbk = Workbooks.Open(Filename:=wkbkFullName)
With Application
.DisplayAlerts = True
.ScreenUpdating = True
.StatusBar = False
End With
End Sub

But maybe it's the location of the code. If you put it in the
activeworkbook's
project, then as soon as the activeworkbook closes, the code stops. It
has to
be in a different workbook.

My next reply pointed out that they were located in the file Personal.xls
When used in another document that has many buttons to allow many funtions
to be
performed on the document, I wanted the document to reload before the user
activates
another function and without having to click on the "Reload Button" on the
toolbar.
Hence, within each of the other function procedures, I included the line:
Application.Run "'Personal.xls'!Module10.Reload"
but the document just closed down even though the "Reload" procedure was in
a different location
different from that of the document. Because there are many other documents
each with their own
individual functions that can be performed on them, I don't want having to
place the "Reload" procedure
in each one of them.


Tom wrote:

"Dave Peterson" wrote in message
...
Maybe you made another change you didn't share???

I don't follow. Do you mean share as in, "Sharing Directory" within MS
Windows Explorer? If so that wasn't the case as all the documents used
were
in the same directory location.

I would have guessed that either the workbook would open or you'd see
an
error message.

Neither. The active workbook just closed with no error message.

<<snipped





  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Closing and reopening the same file

I read your first message and I thought that you may have done something
different than what you described.

How do you execute this macro?

If it's from a shortcut key, make sure that shortcut key combination does not
include the shift key.

Tom wrote:

"Dave Peterson" wrote in message
...
I meant that maybe you made a change to the suggested code and you didn't
share
it in your follow-up post. Share your curent version.

In my first reply I pointed out that the codes did exactly as I wanted.
Meaning that they did work. I placed a button
in the toolbar to activate it. Here they a
Sub Reload()

' Reload the active document.
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
Dim wkbkFullName As String
Dim wkbk As Workbook
With ActiveWorkbook
wkbkFullName = .FullName
.Close savechanges:=False
End With
Set wkbk = Workbooks.Open(Filename:=wkbkFullName)
With Application
.DisplayAlerts = True
.ScreenUpdating = True
.StatusBar = False
End With
End Sub

But maybe it's the location of the code. If you put it in the
activeworkbook's
project, then as soon as the activeworkbook closes, the code stops. It
has to
be in a different workbook.

My next reply pointed out that they were located in the file Personal.xls
When used in another document that has many buttons to allow many funtions
to be
performed on the document, I wanted the document to reload before the user
activates
another function and without having to click on the "Reload Button" on the
toolbar.
Hence, within each of the other function procedures, I included the line:
Application.Run "'Personal.xls'!Module10.Reload"
but the document just closed down even though the "Reload" procedure was in
a different location
different from that of the document. Because there are many other documents
each with their own
individual functions that can be performed on them, I don't want having to
place the "Reload" procedure
in each one of them.


Tom wrote:

"Dave Peterson" wrote in message
...
Maybe you made another change you didn't share???
I don't follow. Do you mean share as in, "Sharing Directory" within MS
Windows Explorer? If so that wasn't the case as all the documents used
were
in the same directory location.

I would have guessed that either the workbook would open or you'd see
an
error message.
Neither. The active workbook just closed with no error message.

<<snipped


--

Dave Peterson
  #12   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 13
Default Closing and reopening the same file

"Dave Peterson" wrote in message
...
I read your first message and I thought that you may have done something
different than what you described.

How do you execute this macro?

I did explain this in my last post. By placing a button in the menu bar and
assigning the name "Personal.xls!Reload" to it, on clicking the button it
executes the procedure. No shortcut key was used at all.
But I'm still puzzled why the procedure did not reload the active document
when it was called from inside another macro.

If it's from a shortcut key, make sure that shortcut key combination does
not
include the shift key.

Tom wrote:

"Dave Peterson" wrote in message
...
I meant that maybe you made a change to the suggested code and you
didn't
share
it in your follow-up post. Share your curent version.

In my first reply I pointed out that the codes did exactly as I wanted.
Meaning that they did work. I placed a button
in the toolbar to activate it. Here they a
Sub Reload()

' Reload the active document.
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
Dim wkbkFullName As String
Dim wkbk As Workbook
With ActiveWorkbook
wkbkFullName = .FullName
.Close savechanges:=False
End With
Set wkbk = Workbooks.Open(Filename:=wkbkFullName)
With Application
.DisplayAlerts = True
.ScreenUpdating = True
.StatusBar = False
End With
End Sub

But maybe it's the location of the code. If you put it in the
activeworkbook's
project, then as soon as the activeworkbook closes, the code stops. It
has to
be in a different workbook.

My next reply pointed out that they were located in the file Personal.xls
When used in another document that has many buttons to allow many
funtions
to be
performed on the document, I wanted the document to reload before the
user
activates
another function and without having to click on the "Reload Button" on
the
toolbar.
Hence, within each of the other function procedures, I included the line:
Application.Run "'Personal.xls'!Module10.Reload"
but the document just closed down even though the "Reload" procedure was
in
a different location
different from that of the document. Because there are many other
documents
each with their own
individual functions that can be performed on them, I don't want having
to
place the "Reload" procedure
in each one of them.


Tom wrote:

"Dave Peterson" wrote in message
...
Maybe you made another change you didn't share???
I don't follow. Do you mean share as in, "Sharing Directory" within MS
Windows Explorer? If so that wasn't the case as all the documents used
were
in the same directory location.

I would have guessed that either the workbook would open or you'd
see
an
error message.
Neither. The active workbook just closed with no error message.

<<snipped


--

Dave Peterson



  #13   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Closing and reopening the same file

Yes you did.

But I have a difficult time picking out your response from the intermingled
text.

I couldn't duplicate your problem.

Are you sure that the button points to the correct macro in the correct
workbook.

You may have noticed that most people top post in the excel newsgroups. I find
it easier to read and follow. You may want to do that, too.

Tom wrote:

"Dave Peterson" wrote in message
...
I meant that maybe you made a change to the suggested code and you didn't
share
it in your follow-up post. Share your curent version.

In my first reply I pointed out that the codes did exactly as I wanted.
Meaning that they did work. I placed a button
in the toolbar to activate it. Here they a
Sub Reload()

' Reload the active document.
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
Dim wkbkFullName As String
Dim wkbk As Workbook
With ActiveWorkbook
wkbkFullName = .FullName
.Close savechanges:=False
End With
Set wkbk = Workbooks.Open(Filename:=wkbkFullName)
With Application
.DisplayAlerts = True
.ScreenUpdating = True
.StatusBar = False
End With
End Sub

But maybe it's the location of the code. If you put it in the
activeworkbook's
project, then as soon as the activeworkbook closes, the code stops. It
has to
be in a different workbook.

My next reply pointed out that they were located in the file Personal.xls
When used in another document that has many buttons to allow many funtions
to be
performed on the document, I wanted the document to reload before the user
activates
another function and without having to click on the "Reload Button" on the
toolbar.
Hence, within each of the other function procedures, I included the line:
Application.Run "'Personal.xls'!Module10.Reload"
but the document just closed down even though the "Reload" procedure was in
a different location
different from that of the document. Because there are many other documents
each with their own
individual functions that can be performed on them, I don't want having to
place the "Reload" procedure
in each one of them.


Tom wrote:

"Dave Peterson" wrote in message
...
Maybe you made another change you didn't share???
I don't follow. Do you mean share as in, "Sharing Directory" within MS
Windows Explorer? If so that wasn't the case as all the documents used
were
in the same directory location.

I would have guessed that either the workbook would open or you'd see
an
error message.
Neither. The active workbook just closed with no error message.

<<snipped


--

Dave Peterson
  #14   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 13
Default Closing and reopening the same file

"Dave Peterson" wrote in message
...
Yes you did.

But I have a difficult time picking out your response from the
intermingled
text.

I am using MS Outlook Express Newsgroup to access this forum. Its newsreader
shows the reply to my post together. So there is no problem following the
thread


I couldn't duplicate your problem.

Are you sure that the button points to the correct macro in the correct
workbook.

Nooooo. The macro procedure attached to the button located in the toolbar
works well but it doesn't work properly when it is called up inside another
procedure. That's what I've been saying.

You may have noticed that most people top post in the excel newsgroups. I
find
it easier to read and follow. You may want to do that, too.

I thought I was when I selected "microsoft.public.excel.misc." to subscribe
from the list of Newsgroups inside Outlook Express. Is there another way?

Tom wrote:

"Dave Peterson" wrote in message
...
I meant that maybe you made a change to the suggested code and you
didn't
share
it in your follow-up post. Share your curent version.

In my first reply I pointed out that the codes did exactly as I wanted.
Meaning that they did work. I placed a button
in the toolbar to activate it. Here they a
Sub Reload()

' Reload the active document.
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
Dim wkbkFullName As String
Dim wkbk As Workbook
With ActiveWorkbook
wkbkFullName = .FullName
.Close savechanges:=False
End With
Set wkbk = Workbooks.Open(Filename:=wkbkFullName)
With Application
.DisplayAlerts = True
.ScreenUpdating = True
.StatusBar = False
End With
End Sub

But maybe it's the location of the code. If you put it in the
activeworkbook's
project, then as soon as the activeworkbook closes, the code stops. It
has to
be in a different workbook.

My next reply pointed out that they were located in the file Personal.xls
When used in another document that has many buttons to allow many
funtions
to be
performed on the document, I wanted the document to reload before the
user
activates
another function and without having to click on the "Reload Button" on
the
toolbar.
Hence, within each of the other function procedures, I included the line:
Application.Run "'Personal.xls'!Module10.Reload"
but the document just closed down even though the "Reload" procedure was
in
a different location
different from that of the document. Because there are many other
documents
each with their own
individual functions that can be performed on them, I don't want having
to
place the "Reload" procedure
in each one of them.


Tom wrote:

"Dave Peterson" wrote in message
...
Maybe you made another change you didn't share???
I don't follow. Do you mean share as in, "Sharing Directory" within MS
Windows Explorer? If so that wasn't the case as all the documents used
were
in the same directory location.

I would have guessed that either the workbook would open or you'd
see
an
error message.
Neither. The active workbook just closed with no error message.

<<snipped


--

Dave Peterson



  #15   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Closing and reopening the same file

If you top post, I'll find it easier to read your responses. Just reply at the
top of the message.

It's got nothing to do with how you're reading the messages. It has everything
to do with how you type your reply in Outlook Express.

If you're calling the procedure from another procedure, then I'd guess that
there was something wrong in that calling procedure.

But I don't recall seeing anything more than:
Application.Run "'Personal.xls'!Module10.Reload"

I asked how you started this other procedure that contained this line and I
don't recall seeing your response. I'm not asking how you click on the button.
I'm asking about how you start the procedure that calls this subroutine.



Tom wrote:

"Dave Peterson" wrote in message
...
Yes you did.

But I have a difficult time picking out your response from the
intermingled
text.

I am using MS Outlook Express Newsgroup to access this forum. Its newsreader
shows the reply to my post together. So there is no problem following the
thread


I couldn't duplicate your problem.

Are you sure that the button points to the correct macro in the correct
workbook.

Nooooo. The macro procedure attached to the button located in the toolbar
works well but it doesn't work properly when it is called up inside another
procedure. That's what I've been saying.

You may have noticed that most people top post in the excel newsgroups. I
find
it easier to read and follow. You may want to do that, too.

I thought I was when I selected "microsoft.public.excel.misc." to subscribe
from the list of Newsgroups inside Outlook Express. Is there another way?

Tom wrote:

"Dave Peterson" wrote in message
...
I meant that maybe you made a change to the suggested code and you
didn't
share
it in your follow-up post. Share your curent version.
In my first reply I pointed out that the codes did exactly as I wanted.
Meaning that they did work. I placed a button
in the toolbar to activate it. Here they a
Sub Reload()

' Reload the active document.
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
Dim wkbkFullName As String
Dim wkbk As Workbook
With ActiveWorkbook
wkbkFullName = .FullName
.Close savechanges:=False
End With
Set wkbk = Workbooks.Open(Filename:=wkbkFullName)
With Application
.DisplayAlerts = True
.ScreenUpdating = True
.StatusBar = False
End With
End Sub

But maybe it's the location of the code. If you put it in the
activeworkbook's
project, then as soon as the activeworkbook closes, the code stops. It
has to
be in a different workbook.
My next reply pointed out that they were located in the file Personal.xls
When used in another document that has many buttons to allow many
funtions
to be
performed on the document, I wanted the document to reload before the
user
activates
another function and without having to click on the "Reload Button" on
the
toolbar.
Hence, within each of the other function procedures, I included the line:
Application.Run "'Personal.xls'!Module10.Reload"
but the document just closed down even though the "Reload" procedure was
in
a different location
different from that of the document. Because there are many other
documents
each with their own
individual functions that can be performed on them, I don't want having
to
place the "Reload" procedure
in each one of them.


Tom wrote:

"Dave Peterson" wrote in message
...
Maybe you made another change you didn't share???
I don't follow. Do you mean share as in, "Sharing Directory" within MS
Windows Explorer? If so that wasn't the case as all the documents used
were
in the same directory location.

I would have guessed that either the workbook would open or you'd
see
an
error message.
Neither. The active workbook just closed with no error message.

<<snipped


--

Dave Peterson


--

Dave Peterson


  #16   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 13
Default Closing and reopening the same file

"Dave Peterson" wrote in message
...

<snip

If you're calling the procedure from another procedure, then I'd
guess that there was something wrong in that calling procedure.

But I don't recall seeing anything more than:
Application.Run "'Personal.xls'!Module10.Reload"

I asked how you started this other procedure that contained this
line and I don't recall seeing your response.

Your question then was, "How do you execute this macro?"
As we were talking about your macro at the time, the word "this" was
understood by me to mean that you wanted to know how I started "your macro".
Having pointed out that this subroutine was intended to be called inside
another macro I quoted the relevant line:
Application.Run "'Personal.xls'!Module10.Reload"
in my reply.
You have clarified your question above when you now use the phrase "this
other procedure". It is linked to another button in the document which calls
it as well as calling on the main procedure which carries out an analytical
task using the data in the document.

I'm not asking how
you click on the button.
I'm asking about how you start the procedure that calls this
subroutine.



Tom wrote:

"Dave Peterson" wrote in message
...
Yes you did.

But I have a difficult time picking out your response from the
intermingled
text.

I am using MS Outlook Express Newsgroup to access this forum. Its
newsreader
shows the reply to my post together. So there is no problem following the
thread


I couldn't duplicate your problem.

Are you sure that the button points to the correct macro in the correct
workbook.

Nooooo. The macro procedure attached to the button located in the toolbar
works well but it doesn't work properly when it is called up inside
another
procedure. That's what I've been saying.

You may have noticed that most people top post in the excel newsgroups.
I
find
it easier to read and follow. You may want to do that, too.

I thought I was when I selected "microsoft.public.excel.misc." to
subscribe
from the list of Newsgroups inside Outlook Express. Is there another way?

Tom wrote:

"Dave Peterson" wrote in message
...
I meant that maybe you made a change to the suggested code and you
didn't
share
it in your follow-up post. Share your curent version.
In my first reply I pointed out that the codes did exactly as I
wanted.
Meaning that they did work. I placed a button
in the toolbar to activate it. Here they a
Sub Reload()

' Reload the active document.
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
Dim wkbkFullName As String
Dim wkbk As Workbook
With ActiveWorkbook
wkbkFullName = .FullName
.Close savechanges:=False
End With
Set wkbk = Workbooks.Open(Filename:=wkbkFullName)
With Application
.DisplayAlerts = True
.ScreenUpdating = True
.StatusBar = False
End With
End Sub

But maybe it's the location of the code. If you put it in the
activeworkbook's
project, then as soon as the activeworkbook closes, the code stops.
It
has to
be in a different workbook.
My next reply pointed out that they were located in the file
Personal.xls
When used in another document that has many buttons to allow many
funtions
to be
performed on the document, I wanted the document to reload before the
user
activates
another function and without having to click on the "Reload Button" on
the
toolbar.
Hence, within each of the other function procedures, I included the
line:
Application.Run "'Personal.xls'!Module10.Reload"
but the document just closed down even though the "Reload" procedure
was
in
a different location
different from that of the document. Because there are many other
documents
each with their own
individual functions that can be performed on them, I don't want
having
to
place the "Reload" procedure
in each one of them.


Tom wrote:

"Dave Peterson" wrote in message
...
Maybe you made another change you didn't share???
I don't follow. Do you mean share as in, "Sharing Directory" within
MS
Windows Explorer? If so that wasn't the case as all the documents
used
were
in the same directory location.

I would have guessed that either the workbook would open or you'd
see
an
error message.
Neither. The active workbook just closed with no error message.

<<snipped

--

Dave Peterson


--

Dave Peterson



  #17   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Closing and reopening the same file



Tom wrote:

"Dave Peterson" wrote in message
...

<snip

If you're calling the procedure from another procedure, then I'd
guess that there was something wrong in that calling procedure.

But I don't recall seeing anything more than:
Application.Run "'Personal.xls'!Module10.Reload"

I asked how you started this other procedure that contained this
line and I don't recall seeing your response.

Your question then was, "How do you execute this macro?"
As we were talking about your macro at the time, the word "this" was
understood by me to mean that you wanted to know how I started "your macro".
Having pointed out that this subroutine was intended to be called inside
another macro I quoted the relevant line:
Application.Run "'Personal.xls'!Module10.Reload"
in my reply.
You have clarified your question above when you now use the phrase "this
other procedure". It is linked to another button in the document which calls
it as well as calling on the main procedure which carries out an analytical
task using the data in the document.

I don't have another guess.

I'm not asking how
you click on the button.
I'm asking about how you start the procedure that calls this
subroutine.



Tom wrote:

"Dave Peterson" wrote in message
...
Yes you did.

But I have a difficult time picking out your response from the
intermingled
text.
I am using MS Outlook Express Newsgroup to access this forum. Its
newsreader
shows the reply to my post together. So there is no problem following the
thread


I couldn't duplicate your problem.

Are you sure that the button points to the correct macro in the correct
workbook.
Nooooo. The macro procedure attached to the button located in the toolbar
works well but it doesn't work properly when it is called up inside
another
procedure. That's what I've been saying.

You may have noticed that most people top post in the excel newsgroups.
I
find
it easier to read and follow. You may want to do that, too.
I thought I was when I selected "microsoft.public.excel.misc." to
subscribe
from the list of Newsgroups inside Outlook Express. Is there another way?

Tom wrote:

"Dave Peterson" wrote in message
...
I meant that maybe you made a change to the suggested code and you
didn't
share
it in your follow-up post. Share your curent version.
In my first reply I pointed out that the codes did exactly as I
wanted.
Meaning that they did work. I placed a button
in the toolbar to activate it. Here they a
Sub Reload()

' Reload the active document.
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
Dim wkbkFullName As String
Dim wkbk As Workbook
With ActiveWorkbook
wkbkFullName = .FullName
.Close savechanges:=False
End With
Set wkbk = Workbooks.Open(Filename:=wkbkFullName)
With Application
.DisplayAlerts = True
.ScreenUpdating = True
.StatusBar = False
End With
End Sub

But maybe it's the location of the code. If you put it in the
activeworkbook's
project, then as soon as the activeworkbook closes, the code stops.
It
has to
be in a different workbook.
My next reply pointed out that they were located in the file
Personal.xls
When used in another document that has many buttons to allow many
funtions
to be
performed on the document, I wanted the document to reload before the
user
activates
another function and without having to click on the "Reload Button" on
the
toolbar.
Hence, within each of the other function procedures, I included the
line:
Application.Run "'Personal.xls'!Module10.Reload"
but the document just closed down even though the "Reload" procedure
was
in
a different location
different from that of the document. Because there are many other
documents
each with their own
individual functions that can be performed on them, I don't want
having
to
place the "Reload" procedure
in each one of them.


Tom wrote:

"Dave Peterson" wrote in message
...
Maybe you made another change you didn't share???
I don't follow. Do you mean share as in, "Sharing Directory" within
MS
Windows Explorer? If so that wasn't the case as all the documents
used
were
in the same directory location.

I would have guessed that either the workbook would open or you'd
see
an
error message.
Neither. The active workbook just closed with no error message.

<<snipped

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
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
Cells widen after saving and reopening file Sigi Rindler Excel Discussion (Misc queries) 2 November 23rd 06 12:03 AM
i zoom to 75% on Excel but returns to 100% reopening file dennis at leapley Excel Worksheet Functions 0 November 17th 06 03:16 PM
Legend box position resetting when reopening file donger Charts and Charting in Excel 0 May 19th 06 08:44 PM
My comments reformat after closing and reopening. Picman Excel Discussion (Misc queries) 0 May 25th 05 04:34 PM
Filter changes upon reopening file! b1 Excel Discussion (Misc queries) 1 December 3rd 04 03:20 AM


All times are GMT +1. The time now is 07:35 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"