Hello Everyone,
I am writing a program whereby I will be able to click on a form button I have designed and have an open dialog box open,whereby I choose a file and basically have contents within that file copied into another file.I would prefer themacro to do it automatically.However,I am not very familiar with open dialog programming and when i write the ffs codes (below),The second bit gives me get the message
RunTime Error 91:"Object variable or With block variable not set."
First code :
Private Sub Workbook_Open()
Call mnuFileOpen_Click
Trad_Accs.Show vbModeless
End Sub
Second Code:
Sub mnuFileOpen_Click()
Dim WhatFile As String
Dim CommonDialog1 As Dialog
CommonDialog1.Filter = "Excel Files (*.xls)|*.xls|Text Files (*.txt)|*.txt"
CommonDialog1.FilterIndex = 2
CommonDialog1.ShowOpen
WhatFile = CommonDialog1.Filename
Iget the error on the second code line4.
Also, I need to display only excel files.
How do I do this??
Secondly,
I can seem to get the
Projects --Components tab in the menu
as i am only able to enter VBA through my worksheet..Is there anyway I can do the CommonDialog program without the icon itself. If not ,how do I get it given that I don't seem to find VBA on my system,and also I need to put the code within my worksheet..
Any assistance will be greatly appreciated
Thanks,
Regards,
romij29
I am writing a program whereby I will be able to click on a form button I have designed and have an open dialog box open,whereby I choose a file and basically have contents within that file copied into another file.I would prefer themacro to do it automatically.However,I am not very familiar with open dialog programming and when i write the ffs codes (below),The second bit gives me get the message
RunTime Error 91:"Object variable or With block variable not set."
First code :
Private Sub Workbook_Open()
Call mnuFileOpen_Click
Trad_Accs.Show vbModeless
End Sub
Second Code:
Sub mnuFileOpen_Click()
Dim WhatFile As String
Dim CommonDialog1 As Dialog
CommonDialog1.Filter = "Excel Files (*.xls)|*.xls|Text Files (*.txt)|*.txt"
CommonDialog1.FilterIndex = 2
CommonDialog1.ShowOpen
WhatFile = CommonDialog1.Filename
Iget the error on the second code line4.
Also, I need to display only excel files.
How do I do this??
Secondly,
I can seem to get the
Projects --Components tab in the menu
as i am only able to enter VBA through my worksheet..Is there anyway I can do the CommonDialog program without the icon itself. If not ,how do I get it given that I don't seem to find VBA on my system,and also I need to put the code within my worksheet..
Any assistance will be greatly appreciated
Thanks,
Regards,
romij29