Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

workbook_open() sub does not work

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
eholz1 - 23 Jan 2008 18:28 GMT
Hello,

I have an excel work book with a number of vba macros.
I have placed in "ThisWorkbook" a workbook_open() and workbook_close()
sub procedures.  The workbook_close seems to always fire correctly.

The workbook_open() either does not fire , or fires sometimes.

I am trying to change the default directory when the sheet/workbook
opens.

Here is my code for this procedure:
I have dimmed the dirPath as Public
Private Sub Workbook_Open()
   dirPath = "D:\Excel\SuzanneBrooks"
   ChDir dirPath
   With ThisWorkbook.Sheets("Risk Control Sheet").lblWorkbook
       .ForeColor = &HFF&
       .Caption = "Workbook not Loaded"
       .Width = 282
       .Height = 13
   End With
   'MsgBox CurDir
End Sub

It seems that the ChDir function does not reliably work?? or I am
missing something in terms of changing directories.

Any tips on this one??

Thanks,

eholz1
Dave Peterson - 23 Jan 2008 18:54 GMT
chdir doesn't change the default drive.

I'd add a line:

chdrive dirpath
chdir dirpath

> Hello,
>
[quoted text clipped - 29 lines]
>
> eholz1

Signature

Dave Peterson

eholz1 - 23 Jan 2008 20:05 GMT
> chdir doesn't change the default drive.
>
[quoted text clipped - 40 lines]
>
> Dave Peterson

Hello Dave,

Thanks for the tip.. I love this newsgroup!

Eric
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.