Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do I refer a cell to workbook name not worksheet | Excel Discussion (Misc queries) | |||
How to refer to the specified sheet in the workbook? | Excel Programming | |||
Refer to picture stored in workbook | Excel Programming | |||
Refer to more than one worksheet in a workbook | Excel Worksheet Functions | |||
how to I refer to current workbook without using its name? | Excel Worksheet Functions |