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

Hi! I have a workbook that I have set as an object by reffering to active
workbook. Then I want to save that workbook but I cannot refer to active
workbook because another workbook is active. Please help me!

Dim oPosFile As Object
Set oPosFile =
Workbooks(ActiveWorkbook.Name).Sheets(ActiveSheet. Name)

'''
ActiveWorkbook.SaveAs Filename:= _
sRMPosSaveFilePath & sRMPosFilename & ".txt",
FileFormat:=xlText _
, CreateBackup:=False
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Refer to workbook

Hi Arne,

I recommend changing oPosFile declaration from an obect variable to a
workbook variable, this will allow "intellisense" to work (ie the VBE will
recgnise what oPosFile is & can make appropriate suggestions for possible
properties &/or methods).
Does the below work for you?

Dim oPosFile As workbook
Set oPosFile = thisworkbook
'...
oPosFile.SaveAs Filename:= _
sRMPosSaveFilePath & sRMPosFilename & ".txt",
FileFormat:=xlText _
, CreateBackup:=False

hth
Rob

__________________
Rob Brockett
NZ
Always learning & the best way to learn is to experience...


"Arne Hegefors" wrote:

Hi! I have a workbook that I have set as an object by reffering to active
workbook. Then I want to save that workbook but I cannot refer to active
workbook because another workbook is active. Please help me!

Dim oPosFile As Object
Set oPosFile =
Workbooks(ActiveWorkbook.Name).Sheets(ActiveSheet. Name)

'''
ActiveWorkbook.SaveAs Filename:= _
sRMPosSaveFilePath & sRMPosFilename & ".txt",
FileFormat:=xlText _
, CreateBackup:=False

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
how do I refer a cell to workbook name not worksheet esparzaone Excel Discussion (Misc queries) 2 October 2nd 07 09:18 PM
How to refer to the specified sheet in the workbook? Jack Excel Programming 1 September 19th 07 11:11 PM
Refer to picture stored in workbook JakeyC Excel Programming 0 April 12th 06 11:24 PM
Refer to more than one worksheet in a workbook Göran M Excel Worksheet Functions 0 January 2nd 06 07:02 AM
how to I refer to current workbook without using its name? confused Excel Worksheet Functions 2 June 16th 05 11:50 PM


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