![]() |
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 |
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 |
All times are GMT +1. The time now is 02:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com