Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Open workbook "inactive"

I open a workbook which has a different name each month - against this
workbook I run a PERSONAL.xls macro which requires that workbook
"Employees.xlsx" is open in the background.
How can I as first item in the Personal.xls-macro open this "Employees.xlsx"
workbook so it is "inactive" and the rest of the macro runs against the
firstly opened workbook which has a different name each month?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 896
Default Open workbook "inactive"

this month yr workbook is "March.xls"

let's presume you only open this a/m file

Edit the macro and put the following in the beginnig/as the first
command:

Workbboks(namethefullpath & "\" & "Employees.xlsx").Open
Workbooks("March.xls).Activate

then run the macro

Hope I didn't miss sth.

;-)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Open workbook "inactive"

Hi Jarek,
What you call "March.xls" is each month different, thus I cannot insert:
Workbooks("March.xls).Activate
since I don't know the name of the file until I actually get it and open it.

To re-itereate:
1. I manually open whatever the mothly file is called
2. I then want to run a PERSONAL.xls "macro1" against that opened file
BUT
FIRST I have to open "Employees.xlsx".
So the PERSONAL.xlsx "macro1" needs to have as its first line:
Workbooks("Employees.xlsx").Open
BUT NOW I have to make this "inactive" and run the rest of the 'MACRO1'
against the other first opened workbook.

Understand??

"Jarek Kujawa" wrote:

this month yr workbook is "March.xls"

let's presume you only open this a/m file

Edit the macro and put the following in the beginnig/as the first
command:

Workbboks(namethefullpath & "\" & "Employees.xlsx").Open
Workbooks("March.xls).Activate

then run the macro

Hope I didn't miss sth.

;-)




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 896
Default Open workbook "inactive"

presume your Personal.xls is hidden

then after Workbooks("Employees.xlsx").Open

put this

ActiveWindow.ActivateNext

does this help?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Open workbook "inactive"

Hi Helmut

One solution would be to open the monthly workbook as part of the macro as
follows and assign it to a variable as follows:

Dim wkbThisMonthsWorkbook As Workbook
Dim bOpened As Boolean

bOpened = Application.FindFile
If Not bOpened Then Exit Sub

Set wkbThisMonthsWorkbook = Workbooks(Workbooks.Count)

Call Workbooks.Open("Employees.xlsx")

wkbThisMonthsWorkbook.Activate

HTH

"Helmut" wrote:

Hi Jarek,
What you call "March.xls" is each month different, thus I cannot insert:
Workbooks("March.xls).Activate
since I don't know the name of the file until I actually get it and open it.

To re-itereate:
1. I manually open whatever the mothly file is called
2. I then want to run a PERSONAL.xls "macro1" against that opened file
BUT
FIRST I have to open "Employees.xlsx".
So the PERSONAL.xlsx "macro1" needs to have as its first line:
Workbooks("Employees.xlsx").Open
BUT NOW I have to make this "inactive" and run the rest of the 'MACRO1'
against the other first opened workbook.

Understand??

"Jarek Kujawa" wrote:

this month yr workbook is "March.xls"

let's presume you only open this a/m file

Edit the macro and put the following in the beginnig/as the first
command:

Workbboks(namethefullpath & "\" & "Employees.xlsx").Open
Workbooks("March.xls).Activate

then run the macro

Hope I didn't miss sth.

;-)




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
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Excel Discussion (Misc queries) 0 April 23rd 09 08:53 PM
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Setting up and Configuration of Excel 0 April 23rd 09 08:53 PM
Code exected at "Workbook Open" slowing/stopping file from opening robs3131 Excel Programming 0 March 4th 08 08:22 AM
Exel 2003, Solver,"Answer" inactive. Dave Excel Discussion (Misc queries) 0 December 2nd 06 08:38 PM
Setting default "open" worksheet in a workbook Worsty[_2_] Excel Programming 1 March 4th 04 01:53 PM


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