Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default File Loading Problems

Okay, here is the problem. The code below crashes out at the
Windows(UFFN).Activate part. I think that the code is assigning False
to the UF instead of assigning the input from the selection window. Is
there some other way to make sure that the then statement runs when the
click Cancel.

While I'm thinking about it, is there some way to make sure the write
restriction password dialog box doesn't appear?

Dim UF As Variant
Dim UFFN As Variant
UF = Application.GetOpenFilename(Title:="This Weeks Projections for
Angie")
If UF < False Then

Workbooks.Open Filename:=UF

Set wbUF = Workbooks.Open(Filename:=UF,
WriteResPassword:="sue")
UFFN = wbUF.Name

Windows(UFFN).Activate
Sheets("Angie").Select
Sheets("Angie").Copy After:=Workbooks("Projection
Summary.xls").Sheets("Summary")
Windows(UFFN).Activate
ActiveWindow.Close
Windows("Projection Summary").Activate

Else

MsgBox "No projection forms selected for Angie. You must
add them manually later."


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default File Loading Problems

I think I'd stop using the Windows collection.

Maybe something like:

Option Explicit
Sub testme02()

Dim UF As Variant
Dim wbUF As Workbook

UF = Application.GetOpenFilename(Title:="This Weeks Projections for Angie")
If UF < False Then
Set wbUF = Workbooks.Open(Filename:=UF, WriteResPassword:="sue")

wbUF.Sheets("angie").Copy _
after:=Workbooks("Projection summary.xls").Sheets("summary")
'or after:=thisworkbook.sheets("summary")

wbUF.Close savechanges:=False
Else
MsgBox "No projection forms selected for Angie. You must" _
& " add them manually later."
End If
End Sub

Untested, but it compiled ok.

Jason Hancock wrote:

Okay, here is the problem. The code below crashes out at the
Windows(UFFN).Activate part. I think that the code is assigning False
to the UF instead of assigning the input from the selection window. Is
there some other way to make sure that the then statement runs when the
click Cancel.

While I'm thinking about it, is there some way to make sure the write
restriction password dialog box doesn't appear?

Dim UF As Variant
Dim UFFN As Variant
UF = Application.GetOpenFilename(Title:="This Weeks Projections for
Angie")
If UF < False Then

Workbooks.Open Filename:=UF

Set wbUF = Workbooks.Open(Filename:=UF,
WriteResPassword:="sue")
UFFN = wbUF.Name

Windows(UFFN).Activate
Sheets("Angie").Select
Sheets("Angie").Copy After:=Workbooks("Projection
Summary.xls").Sheets("Summary")
Windows(UFFN).Activate
ActiveWindow.Close
Windows("Projection Summary").Activate

Else

MsgBox "No projection forms selected for Angie. You must
add them manually later."

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!


--

Dave Peterson

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
Loading problems Gilbert DE CEULAER Excel Discussion (Misc queries) 1 January 25th 09 04:45 PM
Problems with Fuction Loading mpeplow Excel Worksheet Functions 1 June 28th 06 12:36 AM
File Loading Problem Jason Hancock Excel Programming 1 June 20th 04 08:53 PM
Loading an Excel file Kevin Sprinkel Excel Programming 0 February 6th 04 04:46 PM
Problems Loading Analysis ToolPak when automating from Visual Basic wikamto Excel Programming 3 July 30th 03 02:18 AM


All times are GMT +1. The time now is 09:30 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"