LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Strange Problem: Opening Excel using VB appends 1

I am opening an Excel file via VB. The file has vba code/macros,
which get fired off on Workbook Open. If there is an error while
opening the document, I have code that kills the particular Process ID
for the respective Excel file. I actually use the FindWindow API
function to determine the window handle, in turn killing the
corresponding id. My issue is that occassionally a 1 gets appened to
the file name (e.g., Bad1.xls) and I have no clue why. Is this
because a copy is created in memory somewhere? As you can see, I need
the exact window name to get the corresponding processid. Since I
don't understand why the 1 gets appended, I can't always assume that
it will append a 1.

Private Sub Command1_Click()
Dim oXLS As New Excel.Application
Dim oWK As New Excel.Workbook

oXLS.Visible = True
Set oWK = Workbooks.Open("C:\Temp\Bad.xls")
Set oXLS = Nothing
Set oWK = Nothing
End Sub

This behavior actually occurs when I do XWrk.PrintOut
ActivePrinter:="Acrobat Distiller" too. Is there anyway to avoid
this? Why is this happening?

TIA
Note: I posted this in VB group and am posting it here also
 
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
Strange Problem in EXCEL Dharmesh Excel Worksheet Functions 5 October 14th 08 09:33 PM
Strange Excel problem RodShaw2 Setting up and Configuration of Excel 0 July 12th 05 05:30 PM
Strange Excel Problem RodShaw2 Setting up and Configuration of Excel 2 July 5th 05 02:19 PM
Strange Excel problem RodShaw2 Setting up and Configuration of Excel 2 July 5th 05 02:04 PM
Strange Excel problem when opening an Excelbook tmarko Excel Discussion (Misc queries) 1 June 30th 05 05:41 PM


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

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"