Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Upon Opening Doc1/Open Doc2 without showing.

Hi,
I have a little code issue that is likely quite easy for someone experienced
in VBA. I have written this code:
Private Sub Workbook_Open()
Workbooks.Open ("document link here")
'Application.ActiveWorkbook.Visible=False This is the bad line!
Application.ActiveWorkbook.Close
End Sub

Basically, upon opening one workbook, I open another, as well and this is
working fine. However, I do not want the second workbook to show at all
during this process (note the commented out code). This commented code
doesn't work but is likely close. Any ideas on the correct syntax for this
line? I have tried a few different ways to no avail.

Your help is appreciated,
--
Michael J. Nowak
Texas City, TX
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Upon Opening Doc1/Open Doc2 without showing.

Not sure what you are up to but you can give this a try. It is the equivalent
of Window - Hide.

Private Sub Workbook_Open()
Workbooks.Open ("document link here")
ActiveWindow.Visible=False
Application.ActiveWorkbook.Close
End Sub

--
HTH...

Jim Thomlinson


"Mike" wrote:

Hi,
I have a little code issue that is likely quite easy for someone experienced
in VBA. I have written this code:
Private Sub Workbook_Open()
Workbooks.Open ("document link here")
'Application.ActiveWorkbook.Visible=False This is the bad line!
Application.ActiveWorkbook.Close
End Sub

Basically, upon opening one workbook, I open another, as well and this is
working fine. However, I do not want the second workbook to show at all
during this process (note the commented out code). This commented code
doesn't work but is likely close. Any ideas on the correct syntax for this
line? I have tried a few different ways to no avail.

Your help is appreciated,
--
Michael J. Nowak
Texas City, TX

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Upon Opening Doc1/Open Doc2 without showing.

Mike,

Try this:

Private Sub Workbook_Open()
Application.ScreenUpdating = False
Workbooks.Open "document link here"
ActiveWindow.Visible = False
Application.ScreenUpdating = True
End Sub

HTH,
Bernie
MS Excel MVP


"Mike" .(donotspam) wrote in message
...
Hi,
I have a little code issue that is likely quite easy for someone experienced
in VBA. I have written this code:
Private Sub Workbook_Open()
Workbooks.Open ("document link here")
'Application.ActiveWorkbook.Visible=False This is the bad line!
Application.ActiveWorkbook.Close
End Sub

Basically, upon opening one workbook, I open another, as well and this is
working fine. However, I do not want the second workbook to show at all
during this process (note the commented out code). This commented code
doesn't work but is likely close. Any ideas on the correct syntax for this
line? I have tried a few different ways to no avail.

Your help is appreciated,
--
Michael J. Nowak
Texas City, TX



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Upon Opening Doc1/Open Doc2 without showing.

Hi Bernie,
Thanks for the reply but I am getting a error "object variable with
block variable not set" on the "ActiveWindow.Visible = False" line. Any
ideas on what I am missing?
--
Michael J. Nowak
Energy Systems/Dow Chemical
Texas City, TX


"Bernie Deitrick" wrote:

Mike,

Try this:

Private Sub Workbook_Open()
Application.ScreenUpdating = False
Workbooks.Open "document link here"
ActiveWindow.Visible = False
Application.ScreenUpdating = True
End Sub

HTH,
Bernie
MS Excel MVP


"Mike" .(donotspam) wrote in message
...
Hi,
I have a little code issue that is likely quite easy for someone experienced
in VBA. I have written this code:
Private Sub Workbook_Open()
Workbooks.Open ("document link here")
'Application.ActiveWorkbook.Visible=False This is the bad line!
Application.ActiveWorkbook.Close
End Sub

Basically, upon opening one workbook, I open another, as well and this is
working fine. However, I do not want the second workbook to show at all
during this process (note the commented out code). This commented code
doesn't work but is likely close. Any ideas on the correct syntax for this
line? I have tried a few different ways to no avail.

Your help is appreciated,
--
Michael J. Nowak
Texas City, TX




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Upon Opening Doc1/Open Doc2 without showing.


Mike,

Everything works in my testing.

What is your exact code? Does the workbook open line work? Is the workbook that is opened already
hidden? (You can save workbooks as hidden already....)

HTH,
Bernie
MS Excel MVP


"Mike" .(donotspam) wrote in message
...
Hi Bernie,
Thanks for the reply but I am getting a error "object variable with
block variable not set" on the "ActiveWindow.Visible = False" line. Any
ideas on what I am missing?
--
Michael J. Nowak
Energy Systems/Dow Chemical
Texas City, TX


"Bernie Deitrick" wrote:

Mike,

Try this:

Private Sub Workbook_Open()
Application.ScreenUpdating = False
Workbooks.Open "document link here"
ActiveWindow.Visible = False
Application.ScreenUpdating = True
End Sub

HTH,
Bernie
MS Excel MVP


"Mike" .(donotspam) wrote in message
...
Hi,
I have a little code issue that is likely quite easy for someone experienced
in VBA. I have written this code:
Private Sub Workbook_Open()
Workbooks.Open ("document link here")
'Application.ActiveWorkbook.Visible=False This is the bad line!
Application.ActiveWorkbook.Close
End Sub

Basically, upon opening one workbook, I open another, as well and this is
working fine. However, I do not want the second workbook to show at all
during this process (note the commented out code). This commented code
doesn't work but is likely close. Any ideas on the correct syntax for this
line? I have tried a few different ways to no avail.

Your help is appreciated,
--
Michael J. Nowak
Texas City, TX






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
showing links when opening Jase Excel Discussion (Misc queries) 0 December 9th 08 02:18 PM
showing picture upon opening file lampatmyfeet Excel Discussion (Misc queries) 0 May 2nd 08 07:21 PM
opening a worksheet without showing excel components bigdaddy3 Excel Worksheet Functions 2 August 11th 05 11:03 AM
run the macros without opening or showing the excel sheet psk[_5_] Excel Programming 0 October 28th 04 08:30 PM
run the macros without opening or showing the excel sheet psk[_4_] Excel Programming 1 October 28th 04 08:11 PM


All times are GMT +1. The time now is 05:52 AM.

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

About Us

"It's about Microsoft Excel"