Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Workbook Open Event not triggering

I've got a file where the Sub Workbook_Open() code will not run if the file
is opened when Excel is not already open, i.e. opened from Explorer or
directly from an e-mail when Excel is not running. However, it runs
perfectly fine if Excel is already running, regardless of initiation method.
Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook Open Event not triggering


Hmmm. I have an instance where the "workbook.open" will not open the
file no matter what is active or not. I have been reading this forum
for two hours and have had no luck.
(Excel 2003 on Win XP)
Not trying to hijack your thread, but maybe we can get two for one in
here. ;)

My code:
Sub Save_As()
'
' Save_As Macro
' Macro recorded 1/3/2006 by rstanich
'
' Keyboard Shortcut: Ctrl+x
'
Dim sDcode As String 'Date Code as String
Dim sScode As String 'Serial Number Code as String
Dim sFname1 As String 'File Name of Original file as String
Dim vFname2 As Variant 'File Name of New file as Variable
Dim vFolder As Variant 'Folder location
Dim bOkToSave As Boolean 'True or False
Dim sPath As String 'Path variable

sPath = ThisWorkbook.path 'Get path of file
'ChDir = sPath 'Change to folder if necessary
bOkToSave = False 'Set variable to False

ThisWorkbook.Activate
Worksheets("Sheet2").Select 'Select Work Sheet 2
sDcode = Range("D2").Value 'Select Cell D2 on Sheet 2
sScode = Range("C2").Value 'Select Cell C2 on Sheet 2
sFname1 = sPath & "\" & "0020-48183-fir_Cal-Precision.xls" 'Set File
Name of Original file
vFname2 = sPath & "\" & vFolder & "0020-48183-fir_Cal-Precision-" &
sDcode & "-" & sScode & ".xls" 'Set new file name

'Create new file name begin
'Check if exists, exit if exists
ActiveWorkbook.SaveAs Filename:=vFname2, FileFormat:=xlNormal
'Self checks for existing file
ThisWorkbook.Activate
'Application.Workbooks.Open Filename:=vFname2

ActiveWorkbook.Close SaveChanges:=False 'Close new
file
'Open original file
Workbooks.Open Filename:=sFname1

End Sub

Remember kids, I am not Tom or Chip, so be gentle with my coding


--
Rick_Stanich
------------------------------------------------------------------------
Rick_Stanich's Profile: http://www.excelforum.com/member.php...o&userid=28957
View this thread: http://www.excelforum.com/showthread...hreadid=497648

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook Open Event not triggering


More info from a new post.
http://www.excelforum.com/showthread...=1#post1441737


--
Rick_Stanich

I am me
------------------------------------------------------------------------
Rick_Stanich's Profile: http://www.excelforum.com/member.php...o&userid=28957
View this thread: http://www.excelforum.com/showthread...hreadid=497648

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Workbook Open Event not triggering

Sorry Rick, I've solved my problem -- sort of.

Seems that my code was somehow bombing. One of my modules was not compiling
correctly and therefore kept ALL of the modules from compiling. It had to do
with a removed reference that I did not want to be part of the file that I
distributed to others. However, by removing the reference the code was no
longer compiling, but oddly enough only doing it that way when Excel was not
already open. If Excel was open, all the modules compiled and ran fine,
except for the "bad" one, obviously.

This does not sound like your initial problem, but may help that other post
you linked here.

"Mike Jerakis" wrote:

I've got a file where the Sub Workbook_Open() code will not run if the file
is opened when Excel is not already open, i.e. opened from Explorer or
directly from an e-mail when Excel is not running. However, it runs
perfectly fine if Excel is already running, regardless of initiation method.
Any ideas?

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
workbooks.open without triggering event Vobiscum[_3_] Excel Programming 2 June 24th 05 07:21 AM
Triggering an event based on reference Supriya Excel Programming 0 January 29th 04 11:50 AM
auto-filter change not triggering worksheet_change event mark Excel Programming 1 September 19th 03 03:01 PM
Triggering click event of a menu in vba steve Excel Programming 4 August 19th 03 06:17 PM
Triggering click event of a menu in vba Tom Ogilvy Excel Programming 0 August 18th 03 07:51 PM


All times are GMT +1. The time now is 08:51 PM.

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"