Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB with Excel COM object: Hiding Opened File

Status
Not open for further replies.

Brent113

Programmer
Aug 13, 2003
67
US
Hi everyone, thanks for looking.

I am using VB6 (not vba) with the Excel com add-in. I take a copy of the spreadsheet and move it to the Windows temp directory so the original can be opened by the user while my program accesses the slightly renamed copy.

My issue is that if the user opens the original, Excel windows for both the original and the copy are opened. Is there a way to hide the window for the temp spreadsheet my program is using?

____________________________________________________________________________
There are only 10 types of people in the world. Those that know binary and those that don't

Brent
 
Yes, there is. When you open it, set the Excel.Application object's Invisible property to true. However, that's normally the default, so you're probably going to want to know how it got changed.

If you're not sure what to do, then post the relevant code and we can have a look at it.

HTH

Bob
 
Thanks for the reply, but someone in the VBA threads helped me.

The command is [Workbook Name].Windows(1).Visible = False

____________________________________________________________________________
There are only 10 types of people in the world. Those that know binary and those that don't

Brent
 
Maybe I wasn't clear.

The problem is upon opening ANOTHER workbook while my program is ALREADY ACCESSING one. It is hidden until then, but opening another makes both visible.

Specifying the particular workbook my program is using to remain hidden is the only way to get past this issue.

____________________________________________________________________________
There are only 10 types of people in the world. Those that know binary and those that don't

Brent
 
I guess you are using GetObject to access the com object which gets an existing instance of Excel if one is being used.

You problem should be solved if you create the Excel object with CreateObject...
 
Having two workbooks opened, they behave differently when are in one excel instance comparing to comparing to two excel instances (copy ranges, maximal size of copied cell contents etc.). So CreateObject.. can cause other problems.

combo
 
Thanks combo, I added that last night and it worked perfectly!

____________________________________________________________________________
There are only 10 types of people in the world. Those that know binary and those that don't

Brent
 
>that

So did you end up using CreateObject or GetObject or something else?
 
I just type tmpbook.Windows(1).visible = false

____________________________________________________________________________
There are only 10 types of people in the world. Those that know binary and those that don't

Brent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top