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: 10
Default Changing the active workbook

I have a workbook called TicketReport.xls which hold the code, I need
to open a workbook that is sent to me and reformat it.
The code starts off ok, it opens the specified workbook but then it
makes the original workbook active. This is the code I have so far:

Sub CreateReport()
Dim fileToOpen As String

'Choose workbook to open
fileToOpen = Application.GetOpenFilename("Text Files (*.txt),*.txt,
Excel Files (*.xls), *.xls", 2)

Workbooks.Open fileToOpen
Workbooks(fileToOpen).Activate
Worksheets("Custom Report").Activate

'Added MsgBox to verify which Workbook & worksheet are active
MsgBox "The name of the active Workbook is " & ActiveWorkbook.Name
MsgBox "The name of the active Sheet is " & ActiveSheet.Name


'Delete "Category" column
myVar = WorksheetFunction.Match("Category", Worksheets("Custom
Report").Range("A1:G1"), 0)

'Insert "Manager" column between STATUS and CALLER columns
'code to format data ....
End Sub

Thanks in advance.

 
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
Changing an active cell format in VBA Packman Excel Discussion (Misc queries) 4 April 6th 06 07:02 PM
Closing Hidden Workbook when Active Workbook is Closed SusanK521 Excel Programming 5 September 24th 05 12:27 AM
changing active cell doug Excel Programming 8 April 2nd 05 07:07 PM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM
Preventing opening workbook inside active workbook. Serge[_4_] Excel Programming 2 November 4th 03 07:51 PM


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